Compare commits

...

66 Commits

Author SHA1 Message Date
Marty Kraimer
3ed241a857 Made checkLink STATIC; Added STATIC to all internal forward references 1996-03-06 14:18:45 +00:00
Marty Kraimer
6e37e4a8b7 Made STATIC static 1996-03-06 14:17:34 +00:00
Marty Kraimer
45910c7eae Added module 1996-03-06 14:16:14 +00:00
Janet B. Anderson
ab72202752 epicsVersion.h now in src/include. 1996-03-04 21:03:48 +00:00
Janet B. Anderson
b728e45751 EPICS Version R3.12.2.2 1996-03-04 20:58:54 +00:00
Janet B. Anderson
8b4249b582 Updated for R3.12.2.2 1996-03-04 17:25:05 +00:00
Janet B. Anderson
bf260930ea Removed unused ARCH_TYPE 1996-03-04 17:24:41 +00:00
Janet B. Anderson
e460c225da Added the command to invoke the gnu version of make as a parm to GetVar 1996-03-04 16:44:53 +00:00
Janet B. Anderson
4a07ca3a11 The command to invoke the gnu version of make is now a parm to GetVar 1996-03-04 16:43:47 +00:00
Marty Kraimer
2aeca30e8f Removed gmake 1996-03-04 14:21:27 +00:00
Marty Kraimer
6ad8e0f575 Simplify 1996-03-04 14:20:33 +00:00
Marty Kraimer
18822cda96 Call printf instead of epicsPrintf to prevent deadlocks. 1996-03-04 14:19:51 +00:00
Marty Kraimer
acaa1b6fbf Cosmetic change 1996-03-04 14:15:04 +00:00
Marty Kraimer
38875dd8a7 Added drvVmic2534 from LBL. NOTE: NOTE YET ANSIFIED 1996-03-04 14:13:53 +00:00
Marty Kraimer
af39a62adc Added devVmic2534 which came from LBL 1996-03-04 14:13:01 +00:00
Marty Kraimer
fc981f3f7b Bug fix reported by Bill Brown and LBL 1996-03-04 14:12:19 +00:00
Marty Kraimer
f726540476 Added dbDumpPath 1996-03-04 14:11:36 +00:00
Marty Kraimer
759d10c50e Added Vmic2534 1996-03-04 14:09:15 +00:00
Marty Kraimer
27d9d4d708 Added epicsLIBOBJS 1996-03-04 14:08:36 +00:00
Marty Kraimer
8643ae7413 New module 1996-03-04 14:07:46 +00:00
Marty Kraimer
f04b9fd8d3 If asInit fails generate error message and terminate. 1996-03-04 14:06:42 +00:00
Marty Kraimer
574eb184cf If asSetFilename has been called and asInit fails make sure error returned 1996-03-04 14:05:11 +00:00
Janet B. Anderson
ff33b704aa Updated README files to reflect directory changes and new installEpics. 1996-02-20 21:04:04 +00:00
Janet B. Anderson
b23500efe6 Moved tools to src/tools dir. base/tools dir removed. 1996-02-20 20:58:44 +00:00
Janet B. Anderson
14f0ea61dd GetVar now found in base/bin dir. base/tools dir removed. 1996-02-20 20:57:15 +00:00
Janet B. Anderson
6dc0835a7d Changed field reference from val to oval in devGpibLib_aoGpibWork 1996-02-16 22:04:58 +00:00
Marty Kraimer
ade952f351 Forgot a ) 1996-02-16 19:57:44 +00:00
Marty Kraimer
dd34fb320b Fixed bugs 1996-02-16 19:27:11 +00:00
Marty Kraimer
86e4be2f04 Dont use path if filename contains / 1996-02-16 19:26:20 +00:00
Jim Kowalkowski
06626adbb8 New file for gnu loader to create C++ executables. 1996-01-31 20:43:47 +00:00
Jim Kowalkowski
5a32f7143d Now installing BSlib. Wow. 1996-01-29 17:18:55 +00:00
Jim Kowalkowski
717ace8079 Added the simple program to allow loading of C++ object modules. 1996-01-29 17:05:58 +00:00
Marty Kraimer
95294e2f3e added 1996-01-25 21:45:25 +00:00
Marty Kraimer
341ec908c2 moved files from /base/include 1996-01-25 21:39:01 +00:00
Marty Kraimer
f91c3356ab uninstall base/man 1996-01-25 21:37:09 +00:00
Marty Kraimer
6b6ef88793 base/rec=>base/db base/include now installed 1996-01-25 21:29:42 +00:00
Marty Kraimer
adea6a0894 moved flex.skel.static from base/include 1996-01-25 21:27:08 +00:00
Marty Kraimer
866e676a7a .ascii=>.db 1996-01-25 21:26:43 +00:00
Marty Kraimer
a8da2b9da4 moved include files from base/include 1996-01-25 21:24:40 +00:00
Marty Kraimer
ff6d6cb70a made iocLogDisable global 1996-01-25 21:20:56 +00:00
Marty Kraimer
d205dc9b10 moved include files. .ascii=> .db; path changes 1996-01-25 21:15:09 +00:00
Marty Kraimer
777e2d093d moved include file from base/include 1996-01-25 21:14:42 +00:00
Marty Kraimer
dbfab6b29e moved includes; .ascii=> .db; path changes 1996-01-25 21:13:33 +00:00
Marty Kraimer
ecaaeb439a extension .ascii => .db 1996-01-25 21:10:07 +00:00
Marty Kraimer
a635590f31 moved include files from base/include 1996-01-25 21:08:08 +00:00
Marty Kraimer
795b9645c9 moved include from base/include; .ascii => .db 1996-01-25 21:07:08 +00:00
Marty Kraimer
fcf601fbf1 moved include file from base/include 1996-01-25 21:05:49 +00:00
Marty Kraimer
b95596f602 Moved include files from base/include 1996-01-25 21:04:37 +00:00
Jeff Hill
d0766a4f38 fixed compile faill resulting from union member name change 1996-01-18 20:54:56 +00:00
Jeff Hill
a650cd3ca2 dont print benign message about client disconnect 1995-12-20 16:59:16 +00:00
Jeff Hill
96bd0f11c9 dont print no connect msg if it is benign 1995-12-20 16:56:47 +00:00
Jeff Hill
aaa2580224 Use connectWithTimeout() instead of connect() 1995-12-19 19:49:20 +00:00
Jeff Hill
84f32df855 added include required by UCX 1995-12-19 19:47:56 +00:00
Jeff Hill
79baa59608 optimized alarm entry sort 1995-12-19 19:41:24 +00:00
Jeff Hill
853031bc90 added author name 1995-12-19 19:40:07 +00:00
Jeff Hill
c3734dcfee function prototype changes 1995-12-19 19:36:20 +00:00
Jeff Hill
f2a8150e2d -cjm 20-Nov-95 Add code for gettimeofday 1995-12-19 19:35:24 +00:00
Jeff Hill
5b8ef5a985 use memset instead of bzero following advice from Jeff Hill and add
a definition of struct timezone to support gettimeofday
1995-12-19 19:35:00 +00:00
Jeff Hill
3aff8d6754 added missing arg to execlp() 1995-12-19 19:33:42 +00:00
Jeff Hill
c12944df48 lock applied externally 1995-12-19 19:32:02 +00:00
Jeff Hill
a09ab523bb no longer uses local variable 1995-12-19 19:31:28 +00:00
Jeff Hill
c02903d397 fixed spelling 1995-12-19 19:30:41 +00:00
Jeff Hill
33608d5c23 added missing prototype 1995-12-19 19:30:18 +00:00
Jeff Hill
293294cb48 changed put test 1995-12-19 19:29:04 +00:00
Jeff Hill
03104dd373 Dont check the array element count when they add the event (just clip it) 1995-12-19 19:28:11 +00:00
Janet B. Anderson
6a922b6515 Added path statements. Moved export statements. 1995-12-11 15:12:01 +00:00
275 changed files with 22742 additions and 1035 deletions

View File

@@ -10,6 +10,12 @@
# [-b] - For fully built release
#
# $Log$
# Revision 1.4 1996/02/20 21:03:53 jba
# Updated README files to reflect directory changes and new installEpics.
#
# Revision 1.3 1995/10/03 15:42:26 jba
# Added *COPYRIGHT* files to release tar file.
#
# Revision 1.2 1995/08/28 15:49:54 jba
# Added startup directory to release tar file
#
@@ -54,8 +60,8 @@
EPICS=${1};
if [ ! -d include -o ! -d src ]; then
echo "Cannot find src or include, are you at the top of EPICS base ?"
if [ ! -d src ]; then
echo "Cannot find src directory, are you at the top of EPICS base ?"
exit 1
fi
@@ -67,8 +73,8 @@ if [ "${2}" = "-b" ]; then
shift
fi
# Retrieve EPICS release string from include/epicsVersion.h
grep EPICS_VERSION_STRING include/epicsVersion.h > /dev/null 2>&1 || ERR=1;
# Retrieve EPICS release string from src/include/epicsVersion.h
grep EPICS_VERSION_STRING src/include/epicsVersion.h > /dev/null 2>&1 || ERR=1;
if [ "$ERR" = "1" ];
then
@@ -76,7 +82,7 @@ if [ "$ERR" = "1" ];
exit 1;
fi
RELS=`grep "EPICS_VERSION_STRING" include/epicsVersion.h \
RELS=`grep "EPICS_VERSION_STRING" src/include/epicsVersion.h \
| sed -e 's-.*Version--' \
-e 's-[ ][ ]*--g' \
-e 's-".*--' \
@@ -84,7 +90,7 @@ RELS=`grep "EPICS_VERSION_STRING" include/epicsVersion.h \
if [ -z "${RELS}" ];
then
echo "TOP: Cannot retrieve release number from include/epicsVersion.h";
echo "TOP: Cannot retrieve release number from src/include/epicsVersion.h";
exit 1;
fi
@@ -95,7 +101,7 @@ echo TOP: Creating ../${RELS}.Tar;
if [ -f ${RELS}.Tar* ];
then
echo "TOP: This release has already been created.";
echo "TOP: Remove Tar file or edit include/epicsVersion.h.";
echo "TOP: Remove Tar file or edit src/include/epicsVersion.h.";
exit 1;
fi
@@ -115,12 +121,18 @@ if [ -d startup ];
>> /tmp/make_release.out.$$;
fi
find config base/include base/man base/tools -name CVS -prune -o \
find config -name CVS -prune -o \
! -type d -print >> /tmp/make_release.out.$$;
# binary / library / default.dctsdr / <rec>Record.h / etc.
if [ $FULLY_BUILT = "YES" ];
then
find base/include -name CVS -prune -o ! -type d -print \
>> /tmp/make_release.out.$$;
find base/man -name CVS -prune -o ! -type d -print \
>> /tmp/make_release.out.$$;
find base/bin -name CVS -prune -o ! -type d -print \
>> /tmp/make_release.out.$$;

View File

@@ -12,6 +12,16 @@
# install because the release.% syntax is illegal.
#
# $Log$
# Revision 1.26 1996/01/25 21:37:09 mrk
# uninstall base/man
#
# Revision 1.25 1996/01/25 21:29:42 mrk
# base/rec=>base/db base/include now installed
#
# Revision 1.24 1995/08/17 20:14:59 jba
# Added base/tools scripts functionality to base/Makefile, removed scripts
# Moved base/tools/MakeRelease to base dir.
#
# Revision 1.23 1995/02/13 15:00:09 jba
# Changed include file from CONFIG_SITE to CONFIG
#
@@ -57,39 +67,29 @@ include $(EPICS)/config/CONFIG
all: install
build:
@(for ARCH in ${BUILD_ARCHS}; \
do \
ARCH_TYPE=$$ARCH \
${MAKE} ${MFLAGS} $@.$$ARCH; \
done)
@(for ARCH in ${BUILD_ARCHS}; do \
${MAKE} $@.$${ARCH}; \
done)
install:
@(for ARCH in ${BUILD_ARCHS}; \
do \
ARCH_TYPE=$$ARCH \
${MAKE} ${MFLAGS} $@.$$ARCH; \
done)
@(for ARCH in ${BUILD_ARCHS}; do \
${MAKE} $@.$${ARCH}; \
done)
depends:
@(for ARCH in ${BUILD_ARCHS}; \
do \
ARCH_TYPE=$$ARCH \
${MAKE} ${MFLAGS} $@.$$ARCH; \
done)
@(for ARCH in ${BUILD_ARCHS}; do \
${MAKE} $@.$${ARCH}; \
done)
clean:
@(for ARCH in ${BUILD_ARCHS}; \
do \
ARCH_TYPE=$$ARCH \
${MAKE} ${MFLAGS} $@.$$ARCH; \
done)
@(for ARCH in ${BUILD_ARCHS}; do \
${MAKE} $@.$${ARCH}; \
done)
uninstall:
@(for ARCH in ${BUILD_ARCHS}; \
do \
ARCH_TYPE=$$ARCH \
${MAKE} ${MFLAGS} $@.$$ARCH; \
done)
@(for ARCH in ${BUILD_ARCHS}; do \
${MAKE} $@.$${ARCH}; \
done)
release:
@echo TOP: Creating Release...
@@ -138,9 +138,12 @@ release.%:
uninstall.%:
@echo "TOP: Uninstalling $* "
@rm -rf ./bin/$* ./lib/$* rec.bak rec
@rm -rf ./bin/$* ./lib/$* db include man
@rm -rf rec.bak rec
clean.%:
@echo "TOP: Cleaning $* "
@find src -type d -name "O.$*" -prune -exec rm -rf {} \;

14
README
View File

@@ -13,7 +13,7 @@ Notes:
2. You must use GNU make (which is now THE supported make utility) for
the build, gnumake. Set your path so that a recent version (e.g.
V3.70) of gnumake is available (as make) before any system supplied makes.
V3.70) of gnumake is available.
----------------------------------------------------------------------------
Part 1 - Configuring and Building EPICS Base
@@ -42,8 +42,8 @@ Notes:
cd epics/base
gnumake - To build and install EPICS.
gnumake clean - To clean temporary object files. Clean will
remove files from ALL O.ARCH dirs, not
gnumake clean - To clean temporary object files. Top level
clean will remove all the O.ARCH dirs, not
only those specified in BUILD_ARCHS.
1.4 To create an EPICS release:
@@ -68,8 +68,8 @@ NOTES:
base. These tar files are then meant to be untarred at that level.
This release will include the "epics/config" directory.
2. EPICS binaries are kept in the bin/ARCH and lib/ARCH directories.
EPICS shellscripts are kept in the tools directory.
2. EPICS binaries and shellscripts are installed into the bin/ARCH and
lib/ARCH directories.
3. During a normal build (a "make" or "make install"), the "depends"
dependency will NOT be invoked. Only if "make depends" is run
@@ -99,7 +99,9 @@ CONFIG_SITE - This file is meant to be changed only by the EPICS system
manager. It specifies:
HOST_ARCH: The system's host architecture (sun4/hp700/etc).
BUILD_ARCHS: List of architectures to be built.
This now come from an environment variable.
CROSS_COMPILER_HOST_ARCHS: List of unix architectures with cross_compilers.
CROSS_COMPILER_TARGET_ARCHS: List of architectures to build epics for.
VX_DIR: Location of vxWorks.
STATIC_BUILD: Whether or not to build clients statically.
etc.

View File

@@ -8,18 +8,7 @@
2) At this point, support for Linux only involves channel access
clients. Since Vxworks is not available for Linux, you must
use other platforms for developing server side code. As for
building databases with dct and gdct, this requires that the
$EPICS/base/tools/makesdr script works properly. Since makesdr
is slated to be removed from the EPICS distribution in a future
release, we didn't feel it was important to include this capability
now. Consequently, when you run make you will receive the error
gnumake[4]: *** [bldDefaultSdr] Error 127
and
gnumake[3]: *** [comsubs.o] Error 1
use other platforms for developing server side code.
3) You MUST start caRepeater by hand before running a client.
Prior to running a client, you must run:

View File

@@ -10,5 +10,3 @@
might be necessary.
- epics/base/tools/bsdinstall was written to replace install for hp.

View File

@@ -11,9 +11,8 @@ solaris directory /usr/ccs/bin is in your search path.
2. It is not possible to compile EPICS under Solaris 2 using only the
GNU gcc compiler -- you must have the Sun SPARCworks ANSI C compiler.
3. EPICS under Solaris 2 no longer uses the UCB compatability
libraries. It does require the /usr/ucb/install program however. In
order to ensure that the /usr/ucblib files are not inherited, you
3. EPICS under Solaris 2 no longer uses the UCB compatability libraries.
In order to ensure that the /usr/ucblib files are not inherited, you
should ensure that your LD_LIBRARY_PATH environment variable does not
include /usr/ucblib when you build any of the host tools.

View File

@@ -11,6 +11,9 @@ DEPLIBS = ./libAs.a\
$(DEPLIBS_BASE)/libCom.a\
$(DEPLIBS_BASE)/libDb.a
INC += asDbLib.h
INC += asLib.h
SRCS.c = ../ascheck.c asLib.c
OBJS = ascheck.o
LIBOBJS = asLib.o

View File

@@ -184,8 +184,9 @@ static long asInitCommon(void)
int asInit(void)
{
asInitCommon();
return(0);
/*If no access configuration file defined return success*/
if(!pacf) return(0);
return(asInitCommon());
}
static void wdCallback(ASDBCALLBACK *pcallback)

78
src/as/asDbLib.h Normal file
View File

@@ -0,0 +1,78 @@
/* share/epicsH/dbAsLib.h */
/* $Id$ */
/* Author: Marty Kraimer Date: 02-23-94*/
/*****************************************************************
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).
*
* Modification Log:
* -----------------
* .01 02-23-94 mrk Initial Implementation
*/
#ifndef INCdbAsLibh
#define INCdbAsLibh
#include <asLib.h>
#include <callback.h>
typedef struct {
CALLBACK callback;
long status;
} ASDBCALLBACK;
int asSetFilename(char *acf);
int asInit(void);
int asInitAsyn(ASDBCALLBACK *pcallback);
int asDbGetAsl( void *paddr);
ASMEMBERPVT asDbGetMemberPvt( void *paddr);
int asdbdump( void);
int aspuag(char *uagname);
int asphag(char *hagname);
int asprules(char *asgname);
int aspmem(char *asgname,int clients);
void asCaStart(void);
void asCaStop(void);
#endif /*INCdbAsLibh*/

223
src/as/asLib.h Normal file
View File

@@ -0,0 +1,223 @@
/* $Id$ */
/* Author: Marty Kraimer Date: 09-27-93*/
/*****************************************************************
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).
*
* Modification Log:
* -----------------
* .01 09-27-93 mrk Initial Implementation
*/
#ifndef INCasLibh
#define INCasLibh
#include <stddef.h>
#include <stdlib.h>
#include <errMdef.h>
#include <ellLib.h>
typedef struct asgMember *ASMEMBERPVT;
typedef struct asgClient *ASCLIENTPVT;
typedef int (*ASINPUTFUNCPTR)(char *buf,int max_size);
typedef enum{
asClientCOAR /*Change of access rights*/
/*For now this is all*/
} asClientStatus;
typedef void (*ASCLIENTCALLBACK) (ASCLIENTPVT,asClientStatus);
/* The following routines are macros with the following syntax
long asCheckGet(ASCLIENTPVT asClientPvt);
long asCheckPut(ASCLIENTPVT asClientPvt);
end of macros
*/
int asInit(void);
long asInitialize(ASINPUTFUNCPTR inputfunction);
/*caller must provide permanent storage for asgName*/
long asAddMember(ASMEMBERPVT *asMemberPvt,char *asgName);
long asRemoveMember(ASMEMBERPVT *asMemberPvt);
/*caller must provide permanent storage for newAsgName*/
long asChangeGroup(ASMEMBERPVT *asMemberPvt,char *newAsgName);
void *asGetMemberPvt(ASMEMBERPVT asMemberPvt);
void asPutMemberPvt(ASMEMBERPVT asMemberPvt,void *userPvt);
/*client must provide permanent storage for user and host*/
long asAddClient(ASCLIENTPVT *asClientPvt,ASMEMBERPVT asMemberPvt,
int asl,char *user,char *host);
/*client must provide permanent storage for user and host*/
long asChangeClient(ASCLIENTPVT asClientPvt,int asl,char *user,char *host);
long asRemoveClient(ASCLIENTPVT *asClientPvt);
void *asGetClientPvt(ASCLIENTPVT asClientPvt);
void asPutClientPvt(ASCLIENTPVT asClientPvt,void *userPvt);
long asRegisterClientCallback(ASCLIENTPVT asClientPvt,
ASCLIENTCALLBACK pcallback);
long asComputeAllAsg(void);
/*asComputeAsg is defined after ASG is defined*/
long asCompute(ASCLIENTPVT asClientPvt);
int asDump(void (*memcallback)(ASMEMBERPVT),void (*clientcallback)(ASCLIENTPVT),int verbose);
int asDumpUag(char *uagname);
int asDumpHag(char *hagname);
int asDumpRules(char *asgname);
int asDumpMem(char *asgname,void (*memcallback)(ASMEMBERPVT),int clients);
int asDumpHash(void);
#define S_asLib_clientsExist (M_asLib| 1) /*Client Exists*/
#define S_asLib_noUag (M_asLib| 2) /*User Access Group does not exist*/
#define S_asLib_noHag (M_asLib| 3) /*Host Access Group does not exist*/
#define S_asLib_noAccess (M_asLib| 4) /*access security: no access allowed*/
#define S_asLib_noModify (M_asLib| 5) /*access security: no modification allowed*/
#define S_asLib_badConfig (M_asLib| 6) /*access security: bad configuration file*/
#define S_asLib_badCalc (M_asLib| 7) /*access security: bad calculation espression*/
#define S_asLib_dupAsg (M_asLib| 8) /*Duplicate Access Security Group */
#define S_asLib_InitFailed (M_asLib| 9) /*access security: Init failed*/
#define S_asLib_asNotActive (M_asLib|10) /*access security is not active*/
#define S_asLib_badMember (M_asLib|11) /*access security: bad ASMEMBERPVT*/
#define S_asLib_badClient (M_asLib|12) /*access security: bad ASCLIENTPVT*/
#define S_asLib_badAsg (M_asLib|13) /*access security: bad ASG*/
#define S_asLib_noMemory (M_asLib|14) /*access security: no Memory */
/*Private declarations */
#define ASMAXINP 12
#ifdef vxWorks
#include <fast_lock.h>
extern FAST_LOCK asLock;
extern int asLockInit;
#endif
extern int asActive;
/* definition of access rights*/
typedef enum{asNOACCESS,asREAD,asWRITE} asAccessRights;
/*Base pointers for access security*/
typedef struct asBase{
ELLLIST uagList;
ELLLIST hagList;
ELLLIST asgList;
void *phash;
} ASBASE;
/*Defs for User Access Groups*/
typedef struct{
ELLNODE node;
char *user;
} UAGNAME;
typedef struct uag{
ELLNODE node;
char *name;
ELLLIST list; /*list of UAGNAME*/
} UAG;
/*Defs for Host Access Groups*/
typedef struct{
ELLNODE node;
char *host;
} HAGNAME;
typedef struct hag{
ELLNODE node;
char *name;
ELLLIST list; /*list of HAGNAME*/
} HAG;
/*Defs for Access SecurityGroups*/
typedef struct {
ELLNODE node;
UAG *puag;
}ASGUAG;
typedef struct {
ELLNODE node;
HAG *phag;
}ASGHAG;
typedef struct{
ELLNODE node;
asAccessRights access;
int level;
int inpUsed; /*mask for which inputs are used*/
int result; /*Result of calc converted to TRUE/FALSE*/
char *calc;
void *rpcl;
ELLLIST uagList; /*List of ASGUAG*/
ELLLIST hagList; /*List of ASGHAG*/
} ASGRULE;
typedef struct{
ELLNODE node;
char *inp;
void *capvt;
struct asg *pasg;
int inpIndex;
}ASGINP;
typedef struct asg{
ELLNODE node;
char *name;
ELLLIST inpList;
ELLLIST ruleList;
ELLLIST memberList;
double *pavalue; /*pointer to array of input values*/
int inpBad; /*mask for which inputs are bad*/
int inpChanged; /*mask showing inputs that have changed*/
} ASG;
typedef struct asgMember {
ELLNODE node;
ASG *pasg;
ELLLIST clientList;
char *asgName;
void *userPvt;
} ASGMEMBER;
typedef struct asgClient {
ELLNODE node;
ASGMEMBER *pasgMember;
char *user;
char *host;
void *userPvt;
ASCLIENTCALLBACK pcallback;
int level;
asAccessRights access;
} ASGCLIENT;
/* function prototypes*/
void *asCalloc(size_t nobj,size_t size);
long asComputeAsg(ASG *pasg);
/*macros*/
#define asCheckGet(asClientPvt)\
(asActive ?\
((asClientPvt)->access>=asREAD ? TRUE : FALSE)\
: TRUE)
#define asCheckPut(asClientPvt)\
(asActive ?\
((asClientPvt)->access>=asWRITE ? TRUE : FALSE)\
: TRUE)
#endif /*INCasLibh*/

View File

@@ -2,6 +2,7 @@ EPICS = ../../../..
include Target.include
include $(EPICS)/config/CONFIG_BASE
INC += bdt.h
LIBOBJS += bdt.o

304
src/bdt/bdt.h Normal file
View File

@@ -0,0 +1,304 @@
#ifndef __BDT_H
#define __BDT_H
/*
* $Log$
* Revision 1.4 1995/07/27 14:21:58 winans
* General mods for first release.
*
* Revision 1.3 1995/05/30 14:47:17 winans
* Added BDT_Ping and a port parm to BdtIpOpen.
*
* Revision 1.2 1995/05/16 15:38:00 winans
* Added BdtEof to BdtState enum list.
* Added WriteLock and DeltaFlagLock to vxWorks-side BDTs.
* Added port number args to BdtOpenListenerTCP() and BdtOpenListenerUDP().
*
* Revision 1.1 1995/05/11 02:08:44 jbk
* new file for the bulk data transfer stuff
*
*/
/*
Author: Jim Kowalkowski
Date: 5/1/95
*/
/* got from protocols(5) (cheated) or /etc/protocols */
#define BDT_UDP 17
#define BDT_TCP 6
/* server ports - in the user reserved area */
#define BDT_UDP_PORT 50296
#define BDT_TCP_PORT 50297
/* Well known service names */
#define BDT_SERVICE_PV "pv"
#define BDT_SERVICE_NAME "name"
#define BDT_SERVICE_DRV "drv"
#define PV_TRANSFER_SIZE 512
/* How often some type of message is expected to arrive at each end-point */
#define BDT_PING_INTERVAL 10 /* Specified in seconds */
#define BDT_CONENCTION_TIMEOUT 25 /* Specified in seconds */
/* message types */
#define BDT_Ok 0
#define BDT_Connect 1
#define BDT_Error 2
#define BDT_Get 3
#define BDT_Put 4
#define BDT_Close 5
#define BDT_Monitor 6
#define BDT_Value 7
#define BDT_Delta 8
#define BDT_Add 9
#define BDT_Delete 10
#define BDT_Ping 11
#define BDT_LAST_VERB 11
/* protocol states */
typedef enum
{ BdtIdle,BdtUnbound,BdtSData,BdtRData,BdtBad,BdtEof } BdtState;
/******************************************************************************
*
* The format of a BDT_Connect message is:
*
* BdtMsgHead.verb (unsigned 16 binary = BDT_Connect)
* BdtMsgHead.size (unsigned 32 bit binary)
* service name length (unsigned 8 bit binary)
* service name string (service name length characters)
* arg1 string length (unsigned 8 bit binary)
* arg1 string (arg1 string length characters)
* ...
*
******************************************************************************/
/******************************************************************************
*
* NOTICE!!!!!!!! MONITORS ARE NOT CURRENTLY SUPPORTED!!!!!!!
*
* The BdtMonitor structure is created on the server-side when ever a client
* registers a monitor. It contains a tag string that is given by the client
* when the monitor is established. This tag string is an arbitrary binary
* string of bytes... presumably used by the client as a pointer or index
* to a status structure that represents the resource being monitored.
*
* The Message portion of the BdtMonitor represents the body of the message
* that is to be sent to the client to indicate the status of the event that
* happened. (It may not be present in the message.)
*
* The BdtMonitor structures are only hooked into the bdt.pMonitor list if they
* are waiting to be sent to the client.
*
* The format of a BDT_Monitor message is:
*
* BdtMsgHead.verb (unsigned 16 binary = BDT_Monitor)
* BdtMsgHead.size (unsigned 32 bit binary)
* TagLength (unsigned 32 bit binary)
* Tag (TagLength characters)
* service name string (BdtMsgHead.size-TagLength-4 characters)
*
* The <service name string> for a monitor message should include the object
* name(s) that are to be monitored.
*
*
* The format of a BDT_Delta message is:
*
* BdtMsgHead.verb (unsigned 16 binary = BDT_Delta)
* BdtMsgHead.size (unsigned 32 bit binary)
* BdtMonitor.TagLength (unsigned 32 bit binary)
* BdtMonitor.Tag (BdtMonitor.TagLength characters)
* BdtMonitor.MessageLength (unsigned 32 bit binary)
* BdtMonitor.Message (BdtMonitor.MessageLength characters)
*
******************************************************************************/
struct bdt;
typedef struct BdtMonitor
{
struct bdt *pBdt; /* Connection to send notices back to */
char *Tag; /* Client-generated tag */
int TagLength; /* Length of tag */
char *Message; /* Server-gen'd status change message */
int MessageLength; /* Length of Message */
struct BdtMonitor *pNext; /* Allow queue of N outbound on BDT */
} BdtMonitor;
typedef int (*BdthandlerFunc)(struct bdt *Bdt);
typedef struct BdtHandlers
{
BdthandlerFunc Ok;
BdthandlerFunc Connect;
BdthandlerFunc Error;
BdthandlerFunc Get;
BdthandlerFunc Put;
BdthandlerFunc Close;
BdthandlerFunc Monitor;
BdthandlerFunc Value;
BdthandlerFunc Delta;
BdthandlerFunc Add;
BdthandlerFunc Delete;
BdthandlerFunc Ping;
} BdtHandlers;
struct bdt
{
int soc;
int remaining_send;
int remaining_recv;
BdtState state;
#ifdef vxWorks
char *Name; /* Service name (used for messages) */
SEM_ID WriteLock;
SEM_ID MonitorLock;
BdtMonitor *pMonitor; /* List of pending monitor events */
BdthandlerFunc *pHandlers; /* Support routines for messages */
void *pService; /* Provate pointer for service */
#endif
};
typedef struct bdt BDT;
struct BdtMsgHead
{
unsigned short verb;
unsigned long size;
};
typedef struct BdtMsgHead BdtMsgHead;
#define BdtGetSocket(BDT) (BDT->soc)
#define BdtGetResidualWrite(BDT) (BDT->remaining_send)
#define BdtGetResidualRead(BDT) (BDT->remaining_recv)
#define BdtGetProtoState(BDT) (BDT->state)
#ifdef vxWorks
#define BdtGetServiceName(BDT) (BDT->Name)
#endif
/* ------------------------------------------------------------------------
Server functions:
BdtOpenListenerTCP:
Open a socket locally bound to the bulk data transfer TCP server port.
Set the socket up as a listener. Return the open socket.
BdtOpenListenerUDP:
Open a socket locally bound to the bulk data transfer UDP server port.
Return the open socket.
------------------------------------------------------------------------ */
int BdtOpenListenerTCP(int Port);
int BdtOpenListenerUDP(int Port);
/* ------------------------------------------------------------------------
Utilities functions:
BdtMakeServer:
Available under unix only. Put process in the background, disassociate
process from controlling terminal and parent process, and prepare
signals for reaping children spawned by the process.
BdtServerClearSignals:
Clear the signal handlers for a process, set them to default.
BdtMakeBDT:
Allocate and initialize a BDT from a socket.
BdtFreeBDT:
Close the open socket and free the memory for the BDT.
------------------------------------------------------------------------ */
#ifndef vxWorks
int BdtMakeServer(char** argv);
int BdtServerClearSignals();
#endif
BDT* BdtMakeBDT(int socket); /* make a BDT from a socket */
int BdtFreeBDT(BDT* bdt); /* free a BDT */
/* ------------------------------------------------------------------------
Client functions:
BdtIpOpen:
Open a connection to an bulk data transfer given the IP address of the
machine where the server exists. The returned BDT is returned unbound,
a connect must be issued before data transactions can take place.
BdtPvOpen:
Open and connect (bind) to a process variable. Data transfers can
take place after this call.
BdtServiceConnect:
Used in conjunction with BdtIpOpen(). Bind an unbound BDT to a
generic service provided by the server at the other end of the open
connection.
BdtPvConnect:
Used in conjunction with BdtIpOpen(). Bind an unbound BDT to a
process variable on the server at the other end of the open
connection.
BdtClose:
Completely close a connection to a server and free the BDT.
BdtDeltaPending:
Check if a delta message arrived at an unexpected time. This function
clears the pending condition.
------------------------------------------------------------------------ */
BDT* BdtIpOpen(char* address, int port);
BDT* BdtPvOpen(char *IocName, char* PvName);
int BdtServiceConnect(BDT* bdt, char* service_name, char *args);
int BdtPvConnect(BDT* bdt, char* pv_name);
int BdtClose(BDT* bdt);
int BdtPvDeltaPending(BDT* bdt);
/* ------------------------------------------------------------------------
Client and Server shared functions:
BdtSendHeader:
Send a message header out to a connect BDT with command and message body
size information.
BdtSendData:
Send a portion or all the message body out a connected BDT. A header
must have previously been sent with length information. The interface
will only allow the amount of data specified in the header to be sent.
BdtWrite:
This call will block until all the data specified in the size parameter
are sent down the socket.
BdtRead:
This call will block until all the data specified in the size parameter
is read from the socket.
BdtReceiveHeader:
Wait until a message header appears at the BDT, return the action and
remaining message body size.
BdtReceiveData:
Wait for a chunk or the entire body of a message to appear at the BDT.
Put the data into the buffer for a maximum size. Return the amount of
data actually received, or zero if there is no data remaining for the
current message.
------------------------------------------------------------------------ */
int BdtSendHeader(BDT* bdt, unsigned short verb, int size);
int BdtSendData(BDT* bdt, void* buffer, int size);
int BdtReceiveHeader(BDT* bdt, int* verb, int* size);
int BdtReceiveData(BDT* bdt, void* buffer, int size);
int BdtRead(int socket, void* buffer, int size);
int BdtWrite(int socket, void* buffer, int size);
int BdtFlushOutput(BDT* bdt);
int BdtPvPutArray(BDT *bdt, short DbrType, void *Buf, unsigned long NumElements, unsigned long ElementSize);
#endif

View File

@@ -3,6 +3,7 @@ include Target.include
include $(EPICS)/config/CONFIG_BASE
INC += cvtTable.h
SRCS.c = ../makeBpt
OBJS = makeBpt

View File

@@ -7,10 +7,10 @@ VX_WARN_YES = -Wall -pedantic
MENUS += menuConvert.h
BPTS += bptTypeJdegC.ascii
BPTS += bptTypeJdegF.ascii
BPTS += bptTypeKdegC.ascii
BPTS += bptTypeKdegF.ascii
BPTS += bptTypeJdegC.db
BPTS += bptTypeJdegF.db
BPTS += bptTypeKdegC.db
BPTS += bptTypeKdegF.db
SRCS.c = \

45
src/bpt/cvtTable.h Normal file
View File

@@ -0,0 +1,45 @@
/* $Id$
* Breakpoint Tables
*
* Author: Marty Kraimer
* Date: 11-7-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-18-92 rcz removed extern
* .02 05-18-92 rcz new database access
* .03 08-19-92 jba add prototypes for cvtRawToEngBpt,cvtEngToRawBpt
*/
#ifndef INCcvtTableh
#define INCcvtTableh 1
/* Global Routines*/
long cvtEngToRawBpt(double *pval,short linr,short init,
void **ppbrk,short *plbrk);
long cvtRawToEngBpt(double *pval,short linr,short init,
void **ppbrk, short *plbrk);
#endif

View File

@@ -118,7 +118,7 @@ int main(argc, argv)
fprintf(stderr,"Input file MUST have .data extension\n");
exit(-1);
}
strcpy(pext,".ascii");
strcpy(pext,".db");
inFile = fopen(argv[1],"r");
if(!inFile) {
fprintf(stderr,"Error opening %s\n",argv[1]);

View File

@@ -10,6 +10,12 @@ DEPLIBS = ./libca.a\
$(DEPLIBS_BASE)/libCom.a
INC += cadef.h
INC += caerr.h
INC += caeventmask.h
INC += calink.h
INC += bsdProto.h
SRCS.c = \
../iocinf.c ../access.c ../test_event.c ../service.c \
../flow_control.c ../repeater.c ../conn.c \

View File

@@ -99,6 +99,9 @@
/************************************************************************/
/*
* $Log$
* Revision 1.80 1995/10/18 16:49:23 jhill
* recv task is now running at a lower priority than the send task under vxWorks
*
* Revision 1.79 1995/10/12 01:30:10 jhill
* new ca_flush_io() mechanism prevents deadlock when they call
* ca_flush_io() from within an event routine. Also forces early
@@ -2094,14 +2097,18 @@ long mask
/*
* Check for huge waveform
*
* (the count is not checked here against the native count
* when connected because this introduces a race condition
* for the client tool - the requested count is clipped to
* the actual count when the monitor request is sent so
* verifying that the requested count is valid here isnt
* required)
*/
if(dbr_size_n(type,count)>MAX_MSG_SIZE-sizeof(caHdr)){
return ECA_TOLARGE;
}
if(count > chix->count && chix->type != TYPENOTCONN)
return ECA_BADCOUNT;
if(!mask)
return ECA_BADMASK;

View File

@@ -7,6 +7,9 @@ static char *sccsId = "@(#) $Id$";
/*
* $Log$
* Revision 1.32 1995/11/29 19:17:25 jhill
* more tests
*
* Revision 1.31 1995/10/12 01:30:28 jhill
* improved the test
*
@@ -682,8 +685,14 @@ void null_event(struct event_handler_args args)
int status;
#if 0
status = ca_put (DBR_DOUBLE, args.chid, &fval);
SEVCHK (status, NULL);
if (ca_state(args.chid)==cs_conn) {
status = ca_put(DBR_FLOAT, args.chid, &fval);
SEVCHK(status, "put failed in null_event()");
}
else {
printf("null_event() called for disconnected %s\n",
ca_name(args.chid));
}
#endif
if (i++ > 1000) {

View File

@@ -1,11 +1,16 @@
#ifdef __cplusplus
extern "C" {
#endif
#include <envDefs.h>
void caSetupAddrList(
ELLLIST *pList,
SOCKET socket);
void caPrintAddrList();
void caPrintAddrList(ELLLIST *pList);
void caDiscoverInterfaces(
ELLLIST *pList,
@@ -21,15 +26,18 @@ void caAddConfiguredAddr(
int local_addr(SOCKET socket, struct sockaddr_in *plcladdr);
unsigned short caFetchPortConfig(ENV_PARAM *pEnv, unsigned short defaultPort);
union caAddr{
struct sockaddr_in inetAddr;
struct sockaddr sockAddr;
};
typedef union ca_addr {
struct sockaddr_in in;
struct sockaddr sa;
}caAddr;
typedef struct {
ELLNODE node;
union caAddr srcAddr;
union caAddr destAddr;
ELLNODE node;
caAddr srcAddr;
caAddr destAddr;
}caAddrNode;
#ifdef __cplusplus
}
#endif

994
src/ca/cadef.h Normal file
View File

@@ -0,0 +1,994 @@
/************************************************************************/
/* */
/* L O S A L A M O S */
/* Los Alamos National Laboratory */
/* Los Alamos, New Mexico 87545 */
/* */
/* Copyright, 1986, The Regents of the University of California. */
/* Author Jeffrey O. Hill */
/* hill@atdiv.lanl.gov */
/* 505 665 1831 */
/* */
/* */
/* History */
/* ------- */
/* */
/* Date Person Comments */
/* ---- ------ -------- */
/* 08xx87 joh Init Release */
/* 031290 joh Added db_access auto include */
/* 031991 joh fixed SEVCHK dbl function call when status */
/* returned indicates unsuccessful completion */
/* 060591 joh delinting */
/* 091691 joh exported channel state */
/* 060392 joh added ca host name MACRO */
/* 072792 joh added ca_test_io() decl */
/* 072792 joh changed compile time flag from VAXC to STDC */
/* so the function prototypes can be used by */
/* other compilers */
/* 072892 joh added function prototype for host name function */
/* 101692 joh use unique name for var in SEVCHK to avoid */
/* clashing with application */
/* 120492 joh turn off VAXC ca_real reduction from double to */
/* float. This was originally provided to ease */
/* integration of the VAX FORTRAN based pt_shell */
/* code which will in all likelyhood no longer */
/* be used. */
/* 120992 joh converted to dll list routines */
/* 061193 joh added missing prototype for ca_clear_channel() */
/* and others */
/* 080593 rcz converted to ell list routines */
/* 090893 joh added client id to channel in use block */
/* 010694 joh added put callback rtn and synch group rtns */
/* 090194 joh support C++ */
/* 101194 joh merged NT changes */
/* */
/*_begin */
/************************************************************************/
/* */
/* Title: GTA high level channel access routines C */
/* function prototypes */
/* File: cadef.h */
/* Environment: Architecture independent */
/* ( Current ports ) */
/* VAXC, VMS V4.6 */
/* SUNC, BSD UNIX V4.3 */
/* SUNC, vxWorks */
/* */
/* */
/* Purpose */
/* ------- */
/* */
/* GTACS universal remote access library function prototypes. */
/* ( C default argument passing mechanisms ) */
/* */
/* Special comments */
/* ------- -------- */
/* "ca_" is the standard prefix for the "channel access" library */
/* function names. */
/* */
/* */
/************************************************************************/
/*_end */
#ifndef INCLcadefh
#define INCLcadefh
#ifdef __cplusplus
extern "C" {
#define CAC_FUNC_PROTO
#endif
#include <shareLib.h>
#ifdef __STDC__
#define CAC_FUNC_PROTO
#endif
#ifndef HDRVERSIONID
# define HDRVERSIONID(NAME,VERS)
#endif /*HDRVERSIONID*/
HDRVERSIONID(cadefh, "@(#) $Id$")
/* auto include of all stuff that cadef.h uses */
#if defined(CAC_FUNC_PROTO) && !defined(CA_DONT_INCLUDE_STDARGH)
#include <stdarg.h>
#endif
#ifndef INCLdb_accessh
#include <db_access.h>
#endif /* INCLdb_accessh */
#ifndef INCLcaerrh
#include <caerr.h>
#endif /* INCLcaerrh */
#ifndef INCLcaeventmaskh
#include <caeventmask.h>
#endif /* INCLcaeventmaskh */
#ifndef INCLellLibh
#include <ellLib.h>
#endif /* INCLellLibh */
/*
*
* NOTE: the channel in use fields type, count, name, and
* host name are available to applications. However it is
* recommended that the following MACROS be used to access them.
*
*/
#define ca_field_type(CHID) ((CHID)->type)
#define ca_element_count(CHID) ((CHID)->count)
#define ca_name(CHID) ((char *)((CHID)+1))
#define ca_puser(CHID) ((CHID)->puser)
#define ca_host_name(CHID) ca_host_name_function(CHID)
#define ca_read_access(CHID) ((CHID)->ar.read_access)
#define ca_write_access(CHID) ((CHID)->ar.write_access)
/*
* cs_ - `channel state'
*
* cs_never_conn valid chid, IOC not found
* cs_prev_conn valid chid, IOC was found, but unavailable
* cs_conn valid chid, IOC was found, still available
* cs_closed invalid chid
*/
enum channel_state{cs_never_conn, cs_prev_conn, cs_conn, cs_closed};
#define ca_state(CHID) ((CHID)->state)
typedef struct ca_access_rights{
unsigned read_access:1;
unsigned write_access:1;
}caar;
/* Format for the arguments to user connection handlers */
struct connection_handler_args{
struct channel_in_use *chid; /* Channel id */
long op; /* External codes for CA op */
};
#ifdef CAC_FUNC_PROTO
typedef void caCh(struct connection_handler_args args);
#else /*CAC_FUNC_PROTO*/
typedef void caCh();
#endif /*CAC_FUNC_PROTO*/
/* Format for the arguments to user access rights handlers */
struct access_rights_handler_args{
struct channel_in_use *chid; /* Channel id */
caar ar; /* New access rights state */
};
#ifdef CAC_FUNC_PROTO
typedef void caArh(struct access_rights_handler_args args);
#else /*CAC_FUNC_PROTO*/
typedef void caArh();
#endif /*CAC_FUNC_PROTO*/
struct channel_in_use{
ELLNODE node; /* list ptrs */
short type; /* database field type */
#define TYPENOTCONN (-1) /* the type when disconnected */
unsigned short count; /* array element count */
union{
unsigned sid; /* server id */
struct db_addr *paddr; /* database address */
} id;
void *puser; /* user available area */
enum channel_state state; /* connected/ disconnected etc */
caar ar; /* access rights */
/*
* The following fields may change or even vanish in the future
*/
caCh *pConnFunc;
caArh *pAccessRightsFunc;
ELLLIST eventq;
unsigned cid; /* client id */
unsigned retry; /* search retry number */
void *piiu; /* private ioc in use block */
#ifdef vxWorks
void *ppn; /* ptr to optional put notify blk */
#endif /* vxWorks */
/*
* channel name stored directly after this structure in a
* null terminated string.
*/
};
typedef struct channel_in_use *chid;
typedef long chtype;
typedef struct pending_event *evid;
typedef double ca_real;
/* The conversion routine to call for each type */
#define VALID_TYPE(TYPE) (((unsigned short)TYPE)<=LAST_BUFFER_TYPE)
/* argument passed to event handlers and callback handlers */
struct event_handler_args{
void *usr; /* User argument supplied when event added */
struct channel_in_use *chid; /* Channel id */
long type; /* the type of the value returned */
long count; /* the element count of the item returned */
void *dbr; /* Pointer to the value returned */
int status; /* CA Status of the op from server - CA V4.1 */
};
struct pending_event{
ELLNODE node; /* list ptrs */
#ifdef CAC_FUNC_PROTO
void (*usr_func)(struct event_handler_args args);
#else /*CAC_FUNC_PROTO*/
void (*usr_func)();
#endif /*CAC_FUNC_PROTO*/
void *usr_arg;
struct channel_in_use *chan;
chtype type; /* requested type for local CA */
unsigned long count; /* requested count for local CA */
/*
* the following provide for reissuing a
* disconnected monitor
*/
ca_real p_delta;
ca_real n_delta;
ca_real timeout;
unsigned id;
unsigned short mask;
};
void epicsShareAPI ca_test_event
(
#ifdef CAC_FUNC_PROTO
struct event_handler_args
#endif /*CAC_FUNC_PROTO*/
);
/* Format for the arguments to user exception handlers */
struct exception_handler_args{
void *usr; /* User argument supplied when event added */
struct channel_in_use *chid; /* Channel id */
long type; /* Requested type for the operation */
long count; /* Requested count for the operation */
void *addr; /* User's address to write results of CA_OP_GET */
long stat; /* Channel access std status code */
long op; /* External codes for channel access operations */
char *ctx; /* A character string containing context info */
};
/*
*
* External OP codes for CA operations
*
*/
#define CA_OP_GET 0
#define CA_OP_PUT 1
#define CA_OP_SEARCH 2
#define CA_OP_ADD_EVENT 3
#define CA_OP_CLEAR_EVENT 4
#define CA_OP_OTHER 5
#define CA_OP_CONN_UP 6
#define CA_OP_CONN_DOWN 7
/************************************************************************/
/* Perform Library Initialization */
/* */
/* Must be called once before calling any of the other routines */
/************************************************************************/
int epicsShareAPI ca_task_initialize
(
#ifdef CAC_FUNC_PROTO
void
#endif /*CAC_FUNC_PROTO*/
);
/************************************************************************/
/* Remove CA facility from your task */
/* */
/* Normally called automatically at task exit */
/************************************************************************/
int epicsShareAPI ca_task_exit
(
#ifdef CAC_FUNC_PROTO
void
#endif /*CAC_FUNC_PROTO*/
);
/************************************************************************/
/* Return a channel identification for the supplied channel name */
/* (and attempt to create a virtual circuit) */
/************************************************************************/
/*
* preferred search mechanism
*/
#define ca_search(NAME,CHIDPTR)\
ca_search_and_connect(NAME, CHIDPTR, 0, 0)
/* ca_search
(
Name IO Value
---- -- -----
char *, NAME R NULL term ASCII channel name string
chid * CHIDPTR RW channel index written here
);
*/
/************************************************************************
* anachronistic entry points *
* **** Fetching a value while searching nolonger supported**** *
************************************************************************/
#define ca_build_channel(NAME,XXXXX,CHIDPTR,YYYYY)\
ca_build_and_connect(NAME, XXXXX, 1, CHIDPTR, YYYYY, 0, 0)
#define ca_array_build(NAME,XXXXX, ZZZZZZ, CHIDPTR,YYYYY)\
ca_build_and_connect(NAME, XXXXX, ZZZZZZ, CHIDPTR, YYYYY, 0, 0)
/*
* preferred search mechanism
*/
int epicsShareAPI ca_search_and_connect
(
#ifdef CAC_FUNC_PROTO
/* Name IO Value */
/* ---- -- ----- */
char *,/* NAME R NULL term ASCII channel name string */
chid *,/* CHIDPTR RW channel index written here */
void (*)(struct connection_handler_args),
/* PFUNC R the address of user's connection handler*/
void * /* PUSER R placed in the channel's puser field */
#endif /*CAC_FUNC_PROTO*/
);
/************************************************************************
* anachronistic entry point *
* **** Fetching a value while searching nolonger supported**** *
************************************************************************/
int epicsShareAPI ca_build_and_connect
(
#ifdef CAC_FUNC_PROTO
/* Name IO Value */
/* ---- -- ----- */
char *, /* NAME R NULL term ASCII channel name string */
chtype, /* GET_TYPE R external channel type to get */
unsigned/* (no get if invalid type) */
long, /* GET_COUNT R array count to get */
chid *, /* CHIDPTR RW channel index written here */
void *, /* PVALUE W A pointer to a user supplied buffer */
void (*)(struct connection_handler_args),
/* PFUNC R the address of user's connection handler*/
void * /* PUSER R placed in the channel's puser field */
#endif /*CAC_FUNC_PROTO*/
);
int epicsShareAPI ca_change_connection_event
(
#ifdef CAC_FUNC_PROTO
chid chix,
void (*pfunc)(struct connection_handler_args)
#endif /*CAC_FUNC_PROTO*/
);
int epicsShareAPI ca_replace_access_rights_event(
#ifdef CAC_FUNC_PROTO
chid chix,
void (*pfunc)(struct access_rights_handler_args)
#endif /*CAC_FUNC_PROTO*/
);
/*
*
* replace the default exception handler
*
*/
int epicsShareAPI ca_add_exception_event
(
#ifdef CAC_FUNC_PROTO
void (*pfunc)(struct exception_handler_args),
void *arg
#endif /*CAC_FUNC_PROTO*/
);
/************************************************************************/
/* deallocate resources reserved for a channel */
/************************************************************************/
int epicsShareAPI ca_clear_channel
(
#ifdef CAC_FUNC_PROTO
/* Name IO Value */
/* ---- -- ----- */
chid /* CHAN, R channel identifier */
#endif /*CAC_FUNC_PROTO*/
);
/************************************************************************/
/* Write a value to a channel */
/************************************************************************/
#define ca_bput(CHID,PVALUE) ca_array_put(DBR_STRING, 1, CHID, (PVALUE))
/*
C Type Name IO Value
------ ----- -- -----
chid CHID R channel id
char * PVALUE R pointer to a binary value string
*/
#define ca_rput(CHID,PVALUE)\
ca_array_put(DBR_FLOAT, 1, CHID, (PVALUE))
/*
C Type Name IO Value
------ ----- -- -----
chid CHID R channel id
dbr_float_t * PVALUE R pointer to a real value
*/
#define ca_put(CHTYPE, CHID, PVALUE) ca_array_put(CHTYPE, 1, CHID, PVALUE)
/*
Name IO Value
---- -- -----
chtype, TYPE R channel type
chid, CHID R channel index
void * PVALUE R pointer to new channel value of type specified
i.e. status = ca_put(DBF_INT,chid,&value)
*/
int epicsShareAPI ca_array_put
(
#ifdef CAC_FUNC_PROTO
/* Name IO Value */
/* ---- -- ----- */
chtype, /* TYPE R channel type */
unsigned long,
/* COUNT R array element count */
chid, /* CHID R channel index */
void * /* PVALUE R pointer to new channel value of type */
/* specified. */
#endif /*CAC_FUNC_PROTO*/
);
/*
* This routine functions identically to the original ca put request
* with the addition of a callback to the user supplied function
* after recod processing completes in the IOC. The arguments
* to the user supplied callback function are declared in
* the structure event_handler_args and include the pointer
* sized user argument supplied when ca_array_get_callback() is called.
*/
int epicsShareAPI ca_array_put_callback
(
#ifdef CAC_FUNC_PROTO
/* Name IO Value */
/* ---- -- ----- */
chtype, /* TYPE R channel type */
unsigned long,
/* COUNT R array element count */
chid, /* CHID R channel index */
void *, /* PVALUE R pointer to new channel value of type */
void (*)(struct event_handler_args),
/* USRFUNC R the address of a user supplied function */
void * /* USRARG R An argument copied to the above function*/
#endif /*CAC_FUNC_PROTO*/
);
/************************************************************************/
/* Read a value from a channel */
/* */
/* */
/************************************************************************/
#define ca_bget(CHID,PVALUE) ca_array_get(DBR_STRING, 1, CHID, PVALUE)
/*
C Type Name IO Value
------ ----- -- -----
chid CHID R channel id
char * PVALUE W string value pointer
*/
#define ca_rget(CHID,PVALUE) ca_array_get(DBR_FLOAT, 1, CHID, PVALUE)
/*
C Type Name IO Value
------ ----- -- -----
chid CHID R channel id
dbr_float_t * PVALUE W real value pointer
*/
#define ca_get(CHTYPE, CHID, PVALUE) ca_array_get(CHTYPE, 1, CHID, PVALUE)
/*
C Type Name IO Value
------ ----- -- -----
chtype, TYPE R channel type
chid, CHID R channel index
void * PVALUE W ptr to where channel value written
*/
int epicsShareAPI ca_array_get
(
#ifdef CAC_FUNC_PROTO
/* Name IO Value */
/* ---- -- ----- */
chtype, /* TYPE R channel type */
unsigned long,
/* COUNT R array element count */
chid, /* CHID R channel index */
void * /* PVALUE W ptr to where channel value written */
#endif /*CAC_FUNC_PROTO*/
);
/************************************************************************/
/* Read a value from a channel and run a callback when the value */
/* returns */
/* */
/* */
/************************************************************************/
#define ca_bget_callback(CHID,PFUNC,ARG)\
ca_array_get_callback(DBR_STRING, 1, CHID, PFUNC, ARG)
/*
C Type Name IO Value
------ ----- -- -----
chid CHID R channel id
void (*)(), PFUNC R the address of a user supplied function
void *, ARG R An argument copied to the above function
*/
#define ca_rget_callback(CHID,PFUNC,ARG)\
ca_array_get_callback(DBR_FLOAT, 1, CHID, PFUNC, ARG)
/*
C Type Name IO Value
------ ----- -- -----
chid CHID R channel id
void (*)(), PFUNC R the address of a user supplied function
void *, ARG R An argument copied to the above function
*/
#define ca_get_callback(CHTYPE, CHID,PFUNC,ARG)\
ca_array_get_callback(CHTYPE, 1, CHID, PFUNC, ARG)
/*
C Type Name IO Value
------ ----- -- -----
chtype, TYPE R channel type
chid, CHID R channel index
void (*)(), PFUNC R the address of a user supplied function
void *, ARG R An argument copied to the above function
*/
int epicsShareAPI ca_array_get_callback
(
#ifdef CAC_FUNC_PROTO
/* Name IO Value */
/* ---- -- ----- */
chtype, /* TYPE R channel type */
unsigned long,
/* COUNT R array element count */
chid, /* CHID R channel index */
void (*)(struct event_handler_args),
/* USRFUNC R the address of a user supplied function */
void * /* USRARG R An argument copied to the above function */
#endif /*CAC_FUNC_PROTO*/
);
/************************************************************************/
/* Specify a function to be executed whenever significant changes */
/* occur to a channel. */
/* NOTES: */
/* 1) Evid may be omited by passing a NULL pointer */
/* */
/* 2) AN array count of zero specifies the native db count */
/* */
/************************************************************************/
typedef struct event_handler_args evargs;
/* Assumes DELTA info comes from the database or defaults */
#define ca_add_event(TYPE,CHID,ENTRY,ARG,EVID)\
ca_add_array_event(TYPE,1,CHID,ENTRY,ARG,0.0,0.0,0.0,EVID)
/* Name IO Value
---- -- -----
chid, CHID R channel index
void
(*)(), USRFUNC R the address of a user supplied function
void *, USRARG R An argument copied to the above function
evid * EVIDPTR W An id to refer to this event by
*/
/* Sets both P_DELTA and M_DELTA below to argument DELTA */
#define ca_add_delta_event(TYPE,CHID,ENTRY,ARG,DELTA,EVID)\
ca_add_array_event(TYPE,1,CHID,ENTRY,ARG,DELTA,DELTA,0.0,EVID)
/* Name IO Value
---- -- -----
chid, CHID R channel index
void
(*)(), USRFUNC R the address of a user supplied function
void *, USRARG R An argument copied to the above function
ca_real, DELTA R Generate events after +-delta excursions
evid * EVIDPTR W An id to refer to this event by
*/
#define ca_add_general_event(TYPE,CHID,ENTRY,ARG,P_DELTA,N_DELTA,TO,EVID)\
ca_add_array_event(TYPE,1,CHID,ENTRY,ARG,P_DELTA,N_DELTA,TO,EVID)
#define ca_add_array_event(TYPE,COUNT,CHID,ENTRY,ARG,P_DELTA,N_DELTA,TO,EVID)\
ca_add_masked_array_event(TYPE,COUNT,CHID,ENTRY,ARG,P_DELTA,N_DELTA,TO,EVID, DBE_VALUE | DBE_ALARM)
int epicsShareAPI ca_add_masked_array_event
(
#ifdef CAC_FUNC_PROTO
/* Name IO Value */
/* ---- -- ----- */
chtype, /* TYPE R requested external channel type */
unsigned long,
/* COUNT R array element count */
chid, /* CHID R channel index */
void (*)(struct event_handler_args),
/* USRFUNC R the address of a user supplied function */
void *, /* USRARG R An argument copied to the above function*/
ca_real,/* P_DELTA R Generate events after +delta excursions */
ca_real,/* N_DELTA R Generate events after -delta excursions */
ca_real,/* TIMEOUT R Generate events after timeout sec */
evid *, /* EVIDPTR W An id to refer to this event by */
long /* MASK R event trigger type */
#endif /*CAC_FUNC_PROTO*/
);
/************************************************************************/
/* Remove a function from a list of those specified to run */
/* whenever significant changes occur to a channel */
/* */
/************************************************************************/
int epicsShareAPI ca_clear_event
(
#ifdef CAC_FUNC_PROTO
/* Name IO Value */
/* ---- -- ----- */
evid /* EVID R Event id returned by add event */
#endif /*CAC_FUNC_PROTO*/
);
/************************************************************************/
/* */
/* Requested data is not necessarily stable prior to */
/* return from called subroutine. Call ca_pend_io() */
/* to guarantee that requested data is stable. Call the routine */
/* ca_flush_io() to force all outstanding subroutine calls to be */
/* sent out over the network. Significant increases in */
/* performance have been measured when batching several remote */
/* subroutine calls together into one message. Additional */
/* improvements can be obtained by performing local processing */
/* in parallel with outstanding remote processing. */
/* */
/* FLOW OF TYPICAL APPLICATION */
/* */
/* search() ! Obtain Channel ids */
/* . ! " */
/* */
/* get() ! several requests for remote info */
/* get() ! " */
/* add_event() ! " */
/* get() ! " */
/* . */
/* . */
/* . */
/* flush_io() ! send get requests */
/* ! optional parallel processing */
/* . ! " */
/* . ! " */
/* pend_io() ! wait for replies from get requests */
/* . ! access to requested data */
/* . ! " */
/* pend_event() ! wait for requested events */
/* */
/************************************************************************/
/************************************************************************/
/* This routine pends waiting for channel events and calls the */
/* functions specified with add_event when events occur. If the */
/* timeout is specified as 0 an infinite timeout is assumed. */
/* if the argument early is specified TRUE then CA_NORMAL is */
/* returned when outstanding queries complete. Otherwise if the */
/* argument early is FALSE the routine does not return until the */
/* entire delay specified by the timeout argument has expired. */
/* ca_flush_io() is called by this routine. If the argument */
/* early is TRUE then ca_pend() will return immediately without */
/* processing outstanding CA labor if no queries are outstanding */
/************************************************************************/
#define ca_pend_event(TIMEOUT) ca_pend((TIMEOUT), 0/*FALSE*/)
#define ca_pend_io(TIMEOUT) ca_pend((TIMEOUT), 1/*TRUE*/)
int epicsShareAPI ca_pend
(
#ifdef CAC_FUNC_PROTO
/* Name IO Value */
/* ---- -- ----- */
ca_real,/* TIMEOUT R timeout in seconds */
int /* EARLY R return early if IO completes */
#endif /*CAC_FUNC_PROTO*/
);
/*
* returns TRUE when queries are outstanding
*/
int epicsShareAPI ca_test_io
(
#ifdef CAC_FUNC_PROTO
/* Name IO Value */
/* ---- -- ----- */
void
#endif /*CAC_FUNC_PROTO*/
);
/************************************************************************/
/* Send out all outstanding messages in the send queue */
/************************************************************************/
int epicsShareAPI ca_flush_io
(
#ifdef CAC_FUNC_PROTO
void
#endif /*CAC_FUNC_PROTO*/
);
void epicsShareAPI ca_signal
(
#ifdef CAC_FUNC_PROTO
/* Name IO Value */
/* ---- -- ----- */
long, /* CODE R status returned from channel access function */
char * /* MSG R null term string printed on error */
#endif /*CAC_FUNC_PROTO*/
);
void epicsShareAPI ca_signal_with_file_and_lineno
(
#ifdef CAC_FUNC_PROTO
/* Name IO Value */
/* ---- -- ----- */
long, /* CODE R status returned from channel access function */
char *, /* MSG R null term string printed on error */
char *, /* FILE R pointer to null terminated file name string */
int /* LINENO R line number */
#endif /*CAC_FUNC_PROTO*/
);
/*
* Provided for efficient test and display of channel access errors
*/
#define SEVCHK(CA_ERROR_CODE, MESSAGE_STRING) \
{ \
int ca_unique_status_name = (CA_ERROR_CODE); \
if(!(ca_unique_status_name & CA_M_SUCCESS)) \
ca_signal_with_file_and_lineno( \
ca_unique_status_name, \
(MESSAGE_STRING), \
__FILE__, \
__LINE__); \
}
char * epicsShareAPI ca_host_name_function
(
#ifdef CAC_FUNC_PROTO
/* Name IO Value */
/* ---- -- ----- */
chid /* CHID R Channel ID */
#endif /*CAC_FUNC_PROTO*/
);
/*
* CA_ADD_FD_REGISTRATION
*
* call their function with their argument whenever
* a new fd is added or removed
* (for use with a manager of the select system call under UNIX)
*
*/
#ifdef CAC_FUNC_PROTO
typedef void CAFDHANDLER(void *parg, int fd, int opened);
#else /*CAC_FUNC_PROTO*/
typedef void CAFDHANDLER();
#endif /*CAC_FUNC_PROTO*/
int epicsShareAPI ca_add_fd_registration(
#ifdef CAC_FUNC_PROTO
CAFDHANDLER *pHandler,
void *pArg
#endif /*CAC_FUNC_PROTO*/
);
#ifdef vxWorks
int epicsShareAPI ca_channel_status(
#ifdef CAC_FUNC_PROTO
int tid
#endif /*CAC_FUNC_PROTO*/
);
#endif
#ifdef vxWorks
#ifdef CAC_FUNC_PROTO
int ca_import(int tid);
#else /*CAC_FUNC_PROTO*/
int ca_import();
#endif /*CAC_FUNC_PROTO*/
#endif /* vxWorks */
#ifdef vxWorks
#ifdef CAC_FUNC_PROTO
int ca_import_cancel(int tid);
#else /*CAC_FUNC_PROTO*/
int ca_import_cancel();
#endif /*CAC_FUNC_PROTO*/
#endif /* vxWorks */
/*
* CA synch groups
*
* This facility will allow the programmer to create
* any number of synchronization groups. The programmer might then
* interleave IO requests within any of the groups. Once The
* IO operations are initiated then the programmer is free to
* block for IO completion within any one of the groups as needed.
*/
typedef unsigned WRITEABLE_CA_SYNC_GID;
#ifdef CAC_FUNC_PROTO
typedef const unsigned CA_SYNC_GID;
#else
typedef unsigned CA_SYNC_GID;
#endif
/*
* create a sync group
*/
int epicsShareAPI ca_sg_create(
#ifdef CAC_FUNC_PROTO
CA_SYNC_GID *pgid
#endif /*CAC_FUNC_PROTO*/
);
/*
* delete a sync group
*/
int epicsShareAPI ca_sg_delete(
#ifdef CAC_FUNC_PROTO
CA_SYNC_GID gid
#endif /*CAC_FUNC_PROTO*/
);
/*
* block for IO performed within a sync group to complete
*/
int epicsShareAPI ca_sg_block(
#ifdef CAC_FUNC_PROTO
CA_SYNC_GID gid,
ca_real timeout
#endif /*CAC_FUNC_PROTO*/
);
/*
* test for sync group IO operations in progress
*/
int epicsShareAPI ca_sg_test(
#ifdef CAC_FUNC_PROTO
CA_SYNC_GID gid
#endif /*CAC_FUNC_PROTO*/
);
/*
* ca_sg_reset
*/
int epicsShareAPI ca_sg_reset(
#ifdef CAC_FUNC_PROTO
CA_SYNC_GID gid
#endif /*CAC_FUNC_PROTO*/
);
/*
* initiate a get within a sync group
* (essentially a ca_array_get() with a sync group specified)
*/
int epicsShareAPI ca_sg_array_get
(
#ifdef CAC_FUNC_PROTO
/* Name IO Value */
/* ---- -- ----- */
CA_SYNC_GID,/* GID R synch group id */
chtype, /* TYPE R channel type */
unsigned long,
/* COUNT R array element count */
chid, /* CHID R channel index */
void * /* PVALUE W ptr to where channel value written */
#endif /*CAC_FUNC_PROTO*/
);
/*
* initiate a put within a sync group
* (essentially a ca_array_put() with a sync group specified)
*/
int epicsShareAPI ca_sg_array_put
(
#ifdef CAC_FUNC_PROTO
/* Name IO Value */
/* ---- -- ----- */
CA_SYNC_GID,/* GID R synch group id */
chtype, /* TYPE R channel type */
unsigned long,
/* COUNT R array element count */
chid, /* CHID R channel index */
void * /* PVALUE R pointer to new channel value of type */
/* specified. */
#endif /*CAC_FUNC_PROTO*/
);
/*
* CA_MODIFY_USER_NAME()
*
* Modify or override the default
* client user name.
*/
#ifdef CAC_FUNC_PROTO
int epicsShareAPI ca_modify_user_name(char *pUserName);
#else /*CAC_FUNC_PROTO*/
int epicsShareAPI ca_modify_user_name();
#endif /*CAC_FUNC_PROTO*/
/*
* CA_MODIFY_HOST_NAME()
*
* Modify or override the default
* client host name.
*/
#ifdef CAC_FUNC_PROTO
int epicsShareAPI ca_modify_host_name(char *pHostName);
#else /*CAC_FUNC_PROTO*/
int epicsShareAPI ca_modify_host_name();
#endif /*CAC_FUNC_PROTO*/
/*
* Put call back is available if the CA server is on version is 4.2
* or higher.
*
* (return true or false)
*/
#ifdef CAC_FUNC_PROTO
int epicsShareAPI ca_v42_ok(chid chan);
#else /*CAC_FUNC_PROTO*/
int epicsShareAPI ca_v42_ok();
#endif /*CAC_FUNC_PROTO*/
/*
* ca_replace_printf_handler ()
*
* for apps that want to change where ca formatted
* text output goes
*/
#if defined(CAC_FUNC_PROTO) && !defined(CA_DONT_INCLUDE_STDARGH)
int epicsShareAPI ca_replace_printf_handler (
int (*ca_printf_func)(const char *pformat, va_list args)
);
#else /*CAC_FUNC_PROTO*/
int epicsShareAPI ca_replace_printf_handler ();
#endif /*CAC_FUNC_PROTO*/
#ifdef __cplusplus
}
#endif
/*
* no additions below this endif
*/
#endif /* INCLcadefh */

216
src/ca/caerr.h Normal file
View File

@@ -0,0 +1,216 @@
/************************************************************************/
/* */
/* L O S A L A M O S */
/* Los Alamos National Laboratory */
/* Los Alamos, New Mexico 87545 */
/* */
/* Copyright, 1986, The Regents of the University of California. */
/* */
/* Author: Jeffrey O. Hill */
/* */
/* History */
/* ------- */
/* */
/* Date Programmer Comments */
/* ---- ---------- -------- */
/* 08--87 joh Init Release */
/* 031290 joh Changed __CAERR__ to INCLcaerrh */
/* 102990 joh added readonly for VAXC share image */
/* 032092 joh added ECA_BADMASK */
/* 072792 joh added ECA_IODONE & ECA_IOINPROGESS */
/* 102992 joh changed wording on the no vx fp message */
/* 011494 joh Added ECA_BADSYNCGRP */
/* 021194 joh Added ECA_PUTCBINPROG */
/* */
/*_begin */
/************************************************************************/
/* */
/* Name: */
/* Title: */
/* File: */
/* Environment: VMS, UNIX, VRTX */
/* Equipment: VAX, SUN, VME */
/* */
/* */
/* Purpose */
/* ------- */
/* */
/* CA error message declaration include file */
/* */
/* */
/* Special comments */
/* ------- -------- */
/* */
/************************************************************************/
/*_end */
#ifndef INCLcaerrh
#define INCLcaerrh
#include <shareLib.h>
#ifndef HDRVERSIONID
# define HDRVERSIONID(NAME,VERS)
#endif /*HDRVERSIONID*/
HDRVERSIONID(caerrh, "@(#) $Id$")
/* CA Status Code Definitions */
#define CA_K_INFO 3 /* successful */
#define CA_K_ERROR 2 /* failed- continue */
#define CA_K_SUCCESS 1 /* successful */
#define CA_K_WARNING 0 /* unsuccessful */
#define CA_K_SEVERE 4 /* failed- quit */
#define CA_K_FATAL CA_K_ERROR | CA_K_SEVERE
#define CA_M_MSG_NO 0x0000FFF8
#define CA_M_SEVERITY 0x00000007
#define CA_M_LEVEL 0x00000003
#define CA_M_SUCCESS 0x00000001
#define CA_M_ERROR 0x00000002
#define CA_M_SEVERE 0x00000004
#define CA_S_MSG_NO 0x0D
#define CA_S_SEVERITY 0x03
#define CA_V_MSG_NO 0x03
#define CA_V_SEVERITY 0x00
#define CA_V_SUCCESS 0x00
/* Define MACROS to extract/insert individual fields from a status value */
#define CA_EXTRACT_MSG_NO(code)\
( ( (code) & CA_M_MSG_NO ) >> CA_V_MSG_NO )
#define CA_EXTRACT_SEVERITY(code)\
( ( (code) & CA_M_SEVERITY ) >> CA_V_SEVERITY )
#define CA_EXTRACT_SUCCESS(code)\
( ( (code) & CA_M_SUCCESS ) >> CA_V_SUCCESS )
#define CA_INSERT_MSG_NO(code)\
( ((code)<< CA_V_MSG_NO) & CA_M_MSG_NO )
#define CA_INSERT_SEVERITY(code)\
( ((code)<< CA_V_SEVERITY)& CA_M_SEVERITY )
#define CA_INSERT_SUCCESS(code)\
( ((code)<< CA_V_SUCCESS) & CA_M_SUCCESS )
#define DEFMSG(SEVERITY,NUMBER)\
(CA_INSERT_MSG_NO(NUMBER) | CA_INSERT_SEVERITY(SEVERITY))
#define ECA_NORMAL DEFMSG(CA_K_SUCCESS, 0)
#define ECA_MAXIOC DEFMSG(CA_K_ERROR, 1)
#define ECA_UKNHOST DEFMSG(CA_K_ERROR, 2)
#define ECA_UKNSERV DEFMSG(CA_K_ERROR, 3)
#define ECA_SOCK DEFMSG(CA_K_ERROR, 4)
#define ECA_CONN DEFMSG(CA_K_WARNING, 5)
#define ECA_ALLOCMEM DEFMSG(CA_K_WARNING, 6)
#define ECA_UKNCHAN DEFMSG(CA_K_WARNING, 7)
#define ECA_UKNFIELD DEFMSG(CA_K_WARNING, 8)
#define ECA_TOLARGE DEFMSG(CA_K_ERROR, 9)
#define ECA_TIMEOUT DEFMSG(CA_K_WARNING, 10)
#define ECA_NOSUPPORT DEFMSG(CA_K_WARNING, 11)
#define ECA_STRTOBIG DEFMSG(CA_K_WARNING, 12)
#define ECA_BADCHID DEFMSG(CA_K_ERROR, 13)
#define ECA_BADTYPE DEFMSG(CA_K_ERROR, 14)
#define ECA_CHIDNOTFND DEFMSG(CA_K_INFO, 15)
#define ECA_CHIDRETRY DEFMSG(CA_K_INFO, 16)
#define ECA_INTERNAL DEFMSG(CA_K_FATAL, 17)
#define ECA_DBLCLFAIL DEFMSG(CA_K_WARNING, 18)
#define ECA_GETFAIL DEFMSG(CA_K_WARNING, 19)
#define ECA_PUTFAIL DEFMSG(CA_K_WARNING, 20)
#define ECA_ADDFAIL DEFMSG(CA_K_WARNING, 21)
#define ECA_BADCOUNT DEFMSG(CA_K_WARNING, 22)
#define ECA_BADSTR DEFMSG(CA_K_ERROR, 23)
#define ECA_DISCONN DEFMSG(CA_K_INFO, 24)
#define ECA_DBLCHNL DEFMSG(CA_K_INFO, 25)
#define ECA_EVDISALLOW DEFMSG(CA_K_ERROR, 26)
#define ECA_BUILDGET DEFMSG(CA_K_WARNING, 27)
#define ECA_NEEDSFP DEFMSG(CA_K_INFO, 28)
#define ECA_OVEVFAIL DEFMSG(CA_K_WARNING, 29)
#define ECA_BADMONID DEFMSG(CA_K_ERROR, 30)
#define ECA_NEWADDR DEFMSG(CA_K_INFO, 31)
#define ECA_NEWCONN DEFMSG(CA_K_INFO, 32)
#define ECA_NOCACTX DEFMSG(CA_K_WARNING, 33)
#define ECA_DEFUNCT DEFMSG(CA_K_FATAL, 34)
#define ECA_EMPTYSTR DEFMSG(CA_K_WARNING, 35)
#define ECA_NOREPEATER DEFMSG(CA_K_INFO, 36)
#define ECA_NOCHANMSG DEFMSG(CA_K_INFO, 37)
#define ECA_DLCKREST DEFMSG(CA_K_INFO, 38)
#define ECA_SERVBEHIND DEFMSG(CA_K_INFO, 39)
#define ECA_NOCAST DEFMSG(CA_K_WARNING, 40)
#define ECA_BADMASK DEFMSG(CA_K_ERROR, 41)
#define ECA_IODONE DEFMSG(CA_K_INFO, 42)
#define ECA_IOINPROGRESS DEFMSG(CA_K_INFO, 43)
#define ECA_BADSYNCGRP DEFMSG(CA_K_ERROR, 44)
#define ECA_PUTCBINPROG DEFMSG(CA_K_ERROR, 45)
#define ECA_NORDACCESS DEFMSG(CA_K_WARNING, 46)
#define ECA_NOWTACCESS DEFMSG(CA_K_WARNING, 47)
#define ECA_ANACHRONISM DEFMSG(CA_K_ERROR, 48)
#define ECA_NOSEARCHADDR DEFMSG(CA_K_WARNING, 49)
#ifndef CA_ERROR_GLBLSOURCE
epicsShareExtern char *ca_message_text[];
#else
char *ca_message_text[]
=
{
"Normal successful completion",
"Maximum simultaneous IOC connections exceeded",
"Unknown internet host",
"Unknown internet service",
"Unable to allocate a new socket",
"Unable to connect to internet host or service",
"Unable to allocate additional dynamic memory",
"Unknown IO channel",
"Record field specified inappropriate for channel specified",
"The array or data structure specified will not fit in CA message buffer",
"User specified timeout on IO operation expired",
"Sorry, that feature is planned but not supported at this time",
"The supplied string is unusually large",
"The request was ignored because the specified channel is disconnected",
"The type you have requested from this channel is unknown",
"Remote Channel not found",
"Unable to locate all user specified channels",
"Channel Access Internal Failure",
"The requested local DB operation failed",
"Could not perform a database value get for that channel",
"Could not perform a database value put for that channel",
"Could not perform a database event add for that channel",
"Count requested inappropriate for that channel",
"The supplied string has improper format",
"Network connection lost",
"Ambiguous channel host (multiple IOC's have a channel by that name)",
"The CA routine called is inappropriate for use within an event handler",
"Database value get for that channel failed during channel search",
"Unable to initialize without the vxWorks VX_FP_TASK task option set",
"Event queue overflow has prevented first pass event after event add",
"A monitor by that id cant be found",
"Remote channel has new network address",
"New or resumed network connection",
"Attempt to import from a task without a CA context failed",
"Attempt to use defunct CA feature failed",
"The supplied string is empty",
"Unable to spawn the CA repeater thread- auto reconnect will fail",
"No channel id match for search reply- search reply ignored",
"Reseting dead connection- will try to reconnect",
"Server (IOC) has fallen behind or is not responding- still waiting",
"No internet interface with broadcast available",
"The event selection mask supplied is empty or inappropriate",
"IO operations have completed",
"IO operations are in progress",
"Invalid synchronous group identifier",
"Put call back operation collision with put call back operation in progress",
"Read access denied",
"Write access denied",
"Sorry, that anachronistic feature of CA is no longer supported",
"The search request/beacon address list was empty after initialization"
};
#endif
#define ca_message(STATUS)\
(ca_message_text[CA_EXTRACT_MSG_NO((STATUS))])
#endif

36
src/ca/caeventmask.h Normal file
View File

@@ -0,0 +1,36 @@
/*
$Id$
caeventmask.h
Modification History
joh 04-16-90 Created
*/
#ifndef INCLcaeventmaskh
#define INCLcaeventmaskh
/*
event selections
(If any more than 8 of these are needed then update the
select field in the event_block struct in db_event.c from
unsigned char to unsigned short)
DBE_VALUE
Trigger an event when a significant change in the channel's value
occurs. Relies on the monitor deadband field under DCT.
DBE_LOG
Trigger an event when an archive significant change in the channel's
valuue occurs. Relies on the archiver monitor deadband field under DCT.
DBE_ALARM
Trigger an event when the alarm state changes
*/
#define DBE_VALUE (1<<0)
#define DBE_LOG (1<<1)
#define DBE_ALARM (1<<2)
#endif

25
src/ca/calink.h Normal file
View File

@@ -0,0 +1,25 @@
/*
* $Id$
*/
#ifndef INCcalinkh
#define INCcalinkh
#ifndef INCerrMdefh
#include <errMdef.h>
#endif
#define S_dbCa_nullarg (M_dbCa | 1) /*dbCa_nullarg*/
#define S_dbCa_failedmalloc (M_dbCa | 3) /*dbCa_failedmalloc*/
#define S_dbCa_foundnull (M_dbCa | 5) /*dbCa_foundnull*/
#define S_dbCa_ECA_EVDISALLOW (M_dbCa | 7) /*dbCa_ECA_EVDISALLOW*/
#define S_dbCa_ECA_BADCHID (M_dbCa | 9) /*dbCa_ECA_BADCHID*/
#define S_dbCa_ECA_BADTYPE (M_dbCa | 11) /*dbCa_ECA_BADTYPE*/
#define S_dbCa_ECA_ALLOCMEM (M_dbCa | 13) /*dbCa_ECA_ALLOCMEM*/
#define S_dbCa_ECA_ADDFAIL (M_dbCa | 15) /*dbCa_ECA_ADDFAIL*/
#define S_dbCa_ECA_STRTOBIG (M_dbCa | 17) /*dbCa_ECA_STRTOBIG*/
#define S_dbCa_ECA_GETFAIL (M_dbCa | 19) /*dbCa_ECA_GETFAIL*/
#define S_dbCa_ECA_BADCOUNT (M_dbCa | 21) /*dbCa_ECA_BADCOUNT*/
#define S_dbCa_ECA_PUTFAIL (M_dbCa | 23) /*dbCa_ECA_PUTFAIL*/
#define S_dbCa_unknownECA (M_dbCa | 25) /*dbCa_unknownECA*/
#define S_dbCa_dbfailure (M_dbCa | 27) /*dbCa_dbfailure*/
#define S_dbCa_cafailure (M_dbCa | 29) /*dbCa_cafailure*/
#endif /* INCcalinkh */

View File

@@ -141,7 +141,7 @@ int catime (char *channelName)
itemList[i].val.intval = 0;
itemList[i].type = DBR_INT;
}
printf ("interger test\n");
printf ("integer test\n");
test (itemList, NELEMENTS(itemList));
printf ("free test\n");

View File

@@ -51,7 +51,6 @@ void flow_control(struct ioc_in_use *piiu)
{
unsigned nbytes;
int status;
int busy = piiu->client_busy;
LOCK;
@@ -74,19 +73,19 @@ void flow_control(struct ioc_in_use *piiu)
*/
if (nbytes) {
piiu->contiguous_msg_count++;
if (!busy)
if (!piiu->client_busy)
if (piiu->contiguous_msg_count >
MAX_CONTIGUOUS_MSG_COUNT) {
piiu->client_busy = TRUE;
ca_busy_message(piiu);
# ifdef DEBUG
# if defined(DEBUG)
printf("fc on\n");
# endif
}
} else {
piiu->contiguous_msg_count = 0;
if (busy) {
# ifdef DEBUG
if (piiu->client_busy) {
# if defined(DEBUG)
printf("fc off\n");
# endif
ca_ready_message(piiu);

View File

@@ -45,8 +45,6 @@ static char *sccsId = "@(#) $Id$";
* also called by the server. All locks required are applied at
* a higher level.
*/
#undef LOCK
#undef UNLOCK
/*
@@ -295,9 +293,9 @@ void caDiscoverInterfaces(ELLLIST *pList, int socket, int port)
continue;
}
pNode->destAddr.inetAddr = *pInetAddr;
pNode->destAddr.inetAddr.sin_port = htons(port);
pNode->srcAddr.inetAddr = localAddr;
pNode->destAddr.in = *pInetAddr;
pNode->destAddr.in.sin_port = htons(port);
pNode->srcAddr.in = localAddr;
/*
* LOCK applied externally

View File

@@ -46,7 +46,10 @@
/* 021794 joh turn on SO_REUSEADDR only after the test for */
/* address in use so that test works on UNIX */
/* kernels that support multicast */
/* $Log$ */
/* $Log$
* Revision 1.60 1995/11/29 19:26:01 jhill
* cleaned up interface to recv() and send()
* */
/* */
/*_begin */
/************************************************************************/
@@ -84,6 +87,7 @@ LOCAL void ca_process_tcp(struct ioc_in_use *piiu);
LOCAL void ca_process_udp(struct ioc_in_use *piiu);
LOCAL void cacRingBufferInit(struct ca_buffer *pBuf, unsigned long size);
LOCAL char *getToken(char **ppString);
LOCAL void close_ioc (IIU *piiu);
@@ -158,7 +162,9 @@ int net_proto
int status;
SOCKET sock;
int true = TRUE;
#if 0
struct sockaddr_in saddr;
#endif
caAddrNode *pNode;
LOCK;
@@ -193,9 +199,9 @@ int net_proto
return ECA_ALLOCMEM;
}
memset((char *)&pNode->destAddr,0,sizeof(pNode->destAddr));
pNode->destAddr.inetAddr.sin_family = AF_INET;
pNode->destAddr.inetAddr.sin_addr = *pnet_addr;
pNode->destAddr.inetAddr.sin_port = htons (port);
pNode->destAddr.in.sin_family = AF_INET;
pNode->destAddr.in.sin_addr = *pnet_addr;
pNode->destAddr.in.sin_port = htons (port);
ellAdd(&piiu->destAddr, &pNode->node);
piiu->recvBytes = tcp_recv_msg;
piiu->sendBytes = cac_tcp_send_msg_piiu;
@@ -326,8 +332,8 @@ int net_proto
/* connect */
status = connect(
sock,
&pNode->destAddr.sockAddr,
sizeof(pNode->destAddr.sockAddr));
&pNode->destAddr.sa,
sizeof(pNode->destAddr.sa));
if(status < 0){
ca_printf("CAC: no conn err=\"%s\"\n", strerror(MYERRNO));
status = socket_close(sock);
@@ -396,6 +402,7 @@ int net_proto
return ECA_CONN;
}
#if 0
memset((char *)&saddr,0,sizeof(saddr));
saddr.sin_family = AF_INET;
/*
@@ -411,6 +418,7 @@ int net_proto
ca_printf("CAC: bind (err=%s)\n",strerror(MYERRNO));
ca_signal(ECA_INTERNAL,"bind failed");
}
#endif
/*
* load user and auto configured
@@ -672,8 +680,8 @@ LOCAL void cac_udp_send_msg_piiu(struct ioc_in_use *piiu)
&piiu->send.buf[piiu->send.rdix],
(int) sendCnt,
0,
&pNode->destAddr.sockAddr,
sizeof(pNode->destAddr.sockAddr));
&pNode->destAddr.sa,
sizeof(pNode->destAddr.sa));
if(status>=0){
actualSendCnt = (unsigned long) status;
assert (actualSendCnt == sendCnt);
@@ -985,7 +993,7 @@ LOCAL void ca_process_tcp(struct ioc_in_use *piiu)
/* post message to the user */
status = post_msg(
piiu,
&pNode->destAddr.inetAddr.sin_addr,
&pNode->destAddr.in.sin_addr,
&piiu->recv.buf[piiu->recv.rdix],
bytesToProcess);
if(status != OK){
@@ -1184,7 +1192,7 @@ LOCAL void ca_process_udp(struct ioc_in_use *piiu)
*
*
*/
void close_ioc (struct ioc_in_use *piiu)
LOCAL void close_ioc (IIU *piiu)
{
caAddrNode *pNode;
chid chix;
@@ -1216,7 +1224,7 @@ void close_ioc (struct ioc_in_use *piiu)
*/
pNode = (caAddrNode *) piiu->destAddr.node.next;
assert (pNode);
removeBeaconInetAddr (&pNode->destAddr.inetAddr.sin_addr);
removeBeaconInetAddr (&pNode->destAddr.in.sin_addr);
/*
* Mark all of their channels disconnected
@@ -1618,13 +1626,13 @@ char *localHostName()
void caAddConfiguredAddr(ELLLIST *pList, ENV_PARAM *pEnv,
SOCKET socket, int port)
{
caAddrNode *pNode;
ENV_PARAM list;
char *pStr;
char *pToken;
union caAddr addr;
union caAddr localAddr;
int status;
caAddrNode *pNode;
ENV_PARAM list;
char *pStr;
char *pToken;
caAddr addr;
caAddr localAddr;
int status;
pStr = envGetConfigParam(
pEnv,
@@ -1637,17 +1645,17 @@ void caAddConfiguredAddr(ELLLIST *pList, ENV_PARAM *pEnv,
/*
* obtain a local address
*/
status = local_addr(socket, &localAddr.inetAddr);
status = local_addr(socket, &localAddr.in);
if(status){
return;
}
while(pToken = getToken(&pStr)){
memset((char *)&addr,0,sizeof(addr));
addr.inetAddr.sin_family = AF_INET;
addr.inetAddr.sin_port = htons(port);
addr.inetAddr.sin_addr.s_addr = inet_addr(pToken);
if(addr.inetAddr.sin_addr.s_addr == -1){
addr.in.sin_family = AF_INET;
addr.in.sin_port = htons(port);
addr.in.sin_addr.s_addr = inet_addr(pToken);
if(addr.in.sin_addr.s_addr == -1){
ca_printf(
"%s: Parsing '%s'\n",
__FILE__,
@@ -1660,11 +1668,9 @@ void caAddConfiguredAddr(ELLLIST *pList, ENV_PARAM *pEnv,
pNode = (caAddrNode *) calloc(1,sizeof(*pNode));
if(pNode){
pNode->destAddr.inetAddr = addr.inetAddr;
pNode->srcAddr.inetAddr = localAddr.inetAddr;
LOCK;
pNode->destAddr.in = addr.in;
pNode->srcAddr.in = localAddr.in;
ellAdd(pList, &pNode->node);
UNLOCK;
}
}
@@ -1719,12 +1725,12 @@ void caPrintAddrList(ELLLIST *pList)
printf("Channel Access Address List\n");
pNode = (caAddrNode *) ellFirst(pList);
while(pNode){
if(pNode->destAddr.sockAddr.sa_family != AF_INET){
if(pNode->destAddr.sa.sa_family != AF_INET){
printf("<addr entry not in internet format>");
continue;
}
printf( "%s\n",
inet_ntoa(pNode->destAddr.inetAddr.sin_addr));
inet_ntoa(pNode->destAddr.in.sin_addr));
pNode = (caAddrNode *) ellNext(&pNode->node);
}

View File

@@ -32,6 +32,9 @@
/************************************************************************/
/* $Log$
* Revision 1.50 1995/10/18 16:45:40 jhill
* Use recast delay greater than one vxWorks tick
*
* Revision 1.49 1995/10/12 01:33:12 jhill
* Initial delay between search frames went from .1 to .01 sec,
* Added flush pending flag, Make all usage of port be unsigned short.
@@ -603,7 +606,6 @@ void freeBeaconHash(struct ca_static *ca_temp);
void removeBeaconInetAddr(const struct in_addr *pnet_addr);
bhe *lookupBeaconInetAddr(const struct in_addr *pnet_addr);
bhe *createBeaconHashEntry(const struct in_addr *pnet_addr);
void close_ioc(IIU *piiu);
void notify_ca_repeater(void);
void cac_clean_iiu_list(void);

View File

@@ -29,6 +29,9 @@
* Modification Log:
* -----------------
* $Log$
* Revision 1.16 1995/10/12 01:35:28 jhill
* Moved cac_mux_io() to iocinf.c
*
* Revision 1.15 1995/08/22 00:22:07 jhill
* Dont recompute connection timers if the time stamp hasnt changed
*
@@ -223,11 +226,11 @@ void ca_spawn_repeater()
* if here
*/
pImageName = "caRepeater";
status = execlp(pImageName, NULL);
status = execlp(pImageName, pImageName, NULL);
if(status<0){
ca_printf("!!WARNING!!\n");
ca_printf("The executable \"%s\" couldnt be located\n", pImageName);
ca_printf("because - %s\n", strerror(MYERRNO));
ca_printf("because of errno = \"%s\"\n", strerror(MYERRNO));
ca_printf("You may need to modify your PATH environment variable.\n");
ca_printf("Creating CA repeater with fork() system call.\n");
ca_printf("Repeater will inherit parents process name and resources.\n");

View File

@@ -795,7 +795,7 @@ const struct in_addr *pnet_addr
pNode = (caAddrNode *) chpiiu->destAddr.node.next;
assert(pNode);
if (pNode->destAddr.inetAddr.sin_addr.s_addr !=
if (pNode->destAddr.in.sin_addr.s_addr !=
pnet_addr->s_addr) {
caHostFromInetAddr(pnet_addr,rej,sizeof(rej));

View File

@@ -8,6 +8,9 @@
* CJM 13-Jul-1994 add fd_set etc for R3.12
* CJM 09-Dec-1994 define fd_set etc. so it will compile for
* both DEC C and Vax C
* CJM 19-Nov-1995 use memset instead of bzero following advice
* from Jeff Hill and add a definition of struct
* timezone to support gettimeofday
*
*/
#ifndef _UCX_H_
@@ -85,7 +88,14 @@ typedef int fd_set ;
#include <iodef.h>
#define IO$_RECEIVE (IO$_WRITEVBLK)
struct timezone {
int tz_minuteswest ; /* minutes west of Greenwich */
int tz_dsttime ; /* type of dst correction */
};
#define TWOPOWER32 4294967296.0
#define TWOPOWER31 2147483648.0
#define UNIX_EPOCH_AS_MJD 40587.0
#endif
#endif

View File

@@ -26,9 +26,15 @@
* Advanced Photon Source
* Argonne National Laboratory
*
*
* Modification Log:
* -----------------
* cjm 20-Nov-95 Add code for gettimeofday
*
* $Log$
* Revision 1.18 1995/10/12 01:35:30 jhill
* Moved cac_mux_io() to iocinf.c
*
* Revision 1.17 1995/08/22 00:27:56 jhill
* added cvs style mod log
*
@@ -44,7 +50,13 @@
#include "iocinf.h"
#ifdef UCX
#include "ucx.h"
#endif
#if 0
#define CONNECTION_TIMER_ID 56
#endif
/*
@@ -59,6 +71,51 @@ void cac_gettimeval(struct timeval *pt)
assert(status==0);
}
/*
* gettimeofday
*/
#ifndef MULTINET
int gettimeofday(struct timeval *tp, struct timezone *tzp)
{
unsigned int quadtime[2] ;
int status ;
int nanosecs ;
double secs ;
int bit31 ;
double dtime ; /* vax 64 bit integer as a double */
if (tp != (struct timeval *)NULL)
{
status = sys$gettim(&quadtime) ;
if (status != SS$_NORMAL)
return -1 ;
else
{
bit31 = quadtime[0] & 0x80000000 ;
dtime = quadtime[1]*TWOPOWER32 + (quadtime[0] & 0x7fffffff) ;
if (bit31 != 0)
dtime = (dtime + TWOPOWER31)/ 10000000.0 ;
else
dtime = dtime / 10000000.0 ;
secs = dtime - UNIX_EPOCH_AS_MJD * 86400. ;
tp->tv_sec = (int)secs ;
tp->tv_usec = (int)((secs - tp->tv_sec)*1000000.0) ;
}
}
if (tzp != (struct timezone *)NULL)
{
tzp->tz_minuteswest = 0 ;
tzp->tz_dsttime = 0 ;
}
return 0 ;
}
#endif
/*
* cac_block_for_io_completion()

View File

@@ -32,6 +32,9 @@
* Modification Log:
* -----------------
* $Log$
* Revision 1.19 1995/11/29 19:15:42 jhill
* added $Log$ to the header
*
*/
/*
@@ -279,10 +282,10 @@ void caDiscoverInterfaces(ELLLIST *pList, SOCKET socket, int port)
return;
}
broadcast_addr(&bcast_addr);
pNode->destAddr.inetAddr.sin_addr.s_addr = bcast_addr.s_addr; //broadcast addr
pNode->destAddr.inetAddr.sin_port = htons(port);
pNode->destAddr.inetAddr.sin_family = AF_INET;
//pNode->srcAddr.inetAddr = 0 ;//localAddr;
pNode->destAddr.in.sin_addr.s_addr = bcast_addr.s_addr; //broadcast addr
pNode->destAddr.in.sin_port = htons(port);
pNode->destAddr.in.sin_family = AF_INET;
//pNode->srcAddr.in = 0 ;//localAddr;
/*
* LOCK applied externally

View File

@@ -93,7 +93,7 @@ int main(int argc,char **argv)
exit(-1);
}
fclose(fp);
strcpy(pfilename,"device.ascii");
strcpy(pfilename,"device.db");
fp = fopen(pfilename,"w");
if(!fp) {
printf("Error opening file %s\n",pfilename);

View File

@@ -69,7 +69,7 @@ int main(int argc,char **argv)
exit(-1);
}
fclose(fp);
strcpy(pfilename,"driver.ascii");
strcpy(pfilename,"driver.db");
fp = fopen(pfilename,"w");
if(!fp) {
printf("Error opening file %s\n",pfilename);

View File

@@ -89,7 +89,7 @@ int main(int argc,char **argv)
fclose(fp);
for(i=0; i<NUM_GBL_MENUS; i++) {
strcpy(pfilename,aiMenuName[i]);
strcat(pfilename,".ascii");
strcat(pfilename,".db");
fp = fopen(pfilename,"w");
if(!fp) {
printf("Error opening file %s\n",pfilename);

View File

@@ -195,7 +195,7 @@ int main(int argc,char **argv)
strcpy(pfilename,recordtypeName);
strcat(pfilename,"Record");
}
strcat(pfilename,".ascii");
strcat(pfilename,".db");
fp = fopen(pfilename,"w");
if(!fp) {
fprintf(stderr,"Error opening file %s\n",pfilename);
@@ -248,7 +248,7 @@ gen_rectype:
indFldDes=-1;
} else {
fprintf(fp,"recordtype(%s) {\n",recordtypeName);
fprintf(fp,"\tinclude \"dbCommon.ascii\" \n");
fprintf(fp,"\tinclude \"dbCommon.db\" \n");
/*Skip fields in dbCommon*/
for(indFldDes=0; indFldDes< precTypDes->no_fields; indFldDes++) {
if(strcmp(precTypDes->papFldDes[indFldDes]->fldname,"FLNK")==0) break;

View File

@@ -0,0 +1,49 @@
#!/bin/sh
BIN=../O.solaris
H=/usr/local/epics/R3.12.2/base/rec
/bin/rm *.db
$BIN/sdr2gblmenu
$BIN/sdr2recordtype dbCommon $H/dbCommon.h
$BIN/sdr2recordtype ai $H/aiRecord.h
$BIN/sdr2recordtype ao $H/aoRecord.h
$BIN/sdr2recordtype aai $H/aaiRecord.h
$BIN/sdr2recordtype aao $H/aaoRecord.h
$BIN/sdr2recordtype bi $H/biRecord.h
$BIN/sdr2recordtype bo $H/boRecord.h
$BIN/sdr2recordtype calc $H/calcRecord.h
$BIN/sdr2recordtype compress $H/compressRecord.h
$BIN/sdr2recordtype dfanout $H/dfanoutRecord.h
$BIN/sdr2recordtype eg $H/egRecord.h
$BIN/sdr2recordtype egevent $H/egeventRecord.h
$BIN/sdr2recordtype er $H/erRecord.h
$BIN/sdr2recordtype erevent $H/ereventRecord.h
$BIN/sdr2recordtype event $H/eventRecord.h
$BIN/sdr2recordtype fanout $H/fanoutRecord.h
$BIN/sdr2recordtype histogram $H/histogramRecord.h
$BIN/sdr2recordtype longin $H/longinRecord.h
$BIN/sdr2recordtype longout $H/longoutRecord.h
$BIN/sdr2recordtype mbbiDirect $H/mbbiDirectRecord.h
$BIN/sdr2recordtype mbbi $H/mbbiRecord.h
$BIN/sdr2recordtype mbboDirect $H/mbboDirectRecord.h
$BIN/sdr2recordtype mbbo $H/mbboRecord.h
$BIN/sdr2recordtype permissive $H/permissiveRecord.h
$BIN/sdr2recordtype pid $H/pidRecord.h
$BIN/sdr2recordtype pulseCounter $H/pulseCounterRecord.h
$BIN/sdr2recordtype pulseDelay $H/pulseDelayRecord.h
$BIN/sdr2recordtype pulseTrain $H/pulseTrainRecord.h
$BIN/sdr2recordtype scan $H/scanRecord.h
$BIN/sdr2recordtype sel $H/selRecord.h
$BIN/sdr2recordtype seq $H/seqRecord.h
$BIN/sdr2recordtype state $H/stateRecord.h
$BIN/sdr2recordtype steppermotor $H/steppermotorRecord.h
$BIN/sdr2recordtype stringin $H/stringinRecord.h
$BIN/sdr2recordtype stringout $H/stringoutRecord.h
$BIN/sdr2recordtype subArray $H/subArrayRecord.h
$BIN/sdr2recordtype sub $H/subRecord.h
$BIN/sdr2recordtype gsub $H/gsubRecord.h
$BIN/sdr2recordtype pal $H/palRecord.h
$BIN/sdr2recordtype timer $H/timerRecord.h
$BIN/sdr2recordtype wait $H/waitRecord.h
$BIN/sdr2recordtype waveform $H/waveformRecord.h
$BIN/sdr2device
$BIN/sdr2driver

25
src/db/Makefile.Unix Normal file
View File

@@ -0,0 +1,25 @@
EPICS = ../../../..
include Target.include
include $(EPICS)/config/CONFIG_BASE
INC += drvTS.h
INC += drvSup.h
INC += callback.h
INC += dbAccess.h
INC += dbConvert.h
INC += dbEvent.h
INC += dbScan.h
INC += db_access.h
INC += db_addr.h
INC += db_field_log.h
INC += fast_lock.h
INC += initHooks.h
INC += recSup.h
INC += devSup.h
INC += task_params.h
INC += taskwd.h
INC += recGbl.h
INC += dbBkpt.h
INC += devLib.h
include $(EPICS)/config/RULES.Unix

View File

@@ -19,7 +19,10 @@ MENUS += menuYesNo.h
RECTYPES += dbCommon.h
ASCII = dbCommonRecord.ascii menuGlobal.ascii all.ascii
DBINSTALL += dbCommonRecord.db
DBINSTALL += menuGlobal.db
DBINSTALL += epics.db
DBINSTALL += epicsLIBOBJS
SRCS.c = \
../dbAccess.c\
@@ -68,12 +71,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

View File

@@ -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
View 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
View 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
View 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

View File

@@ -1,3 +0,0 @@
recordtype(dbCommon) {
include "dbCommon.ascii"
}

3
src/db/dbCommonRecord.db Normal file
View File

@@ -0,0 +1,3 @@
recordtype(dbCommon) {
include "dbCommon.db"
}

39
src/db/dbConvert.h Normal file
View 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
View 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
View 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

View File

@@ -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);
}

View File

@@ -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

File diff suppressed because it is too large Load Diff

49
src/db/db_addr.h Normal file
View 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
View 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
View 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
View 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
View 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
View 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

238
src/db/epics.db Normal file
View File

@@ -0,0 +1,238 @@
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")
#device(bi,VME_IO,devBiVmic2534,"Vmic2534")
#device(bo,VME_IO,devBoVmic2534,"Vmic2534")
#device(mbbi,VME_IO,devMbbiVmic2534,"Vmic2534")
#device(mbbo,VME_IO,devMbboVmic2534,"Vmic2534")
#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)
#driver(drvVmi2534)

204
src/db/epicsLIBOBJS Normal file
View File

@@ -0,0 +1,204 @@
#LIBOBJS += $(EPICS_BASE_BIN)/aaiRecord.o
#LIBOBJS += $(EPICS_BASE_BIN)/aaoRecord.o
LIBOBJS += $(EPICS_BASE_BIN)/aiRecord.o
LIBOBJS += $(EPICS_BASE_BIN)/aoRecord.o
LIBOBJS += $(EPICS_BASE_BIN)/biRecord.o
LIBOBJS += $(EPICS_BASE_BIN)/boRecord.o
LIBOBJS += $(EPICS_BASE_BIN)/calcRecord.o
LIBOBJS += $(EPICS_BASE_BIN)/compressRecord.o
LIBOBJS += $(EPICS_BASE_BIN)/dfanoutRecord.o
#LIBOBJS += $(EPICS_BASE_BIN)/egRecord.o
#LIBOBJS += $(EPICS_BASE_BIN)/egeventRecord.o
#LIBOBJS += $(EPICS_BASE_BIN)/erRecord.o
#LIBOBJS += $(EPICS_BASE_BIN)/ereventRecord.o
LIBOBJS += $(EPICS_BASE_BIN)/eventRecord.o
LIBOBJS += $(EPICS_BASE_BIN)/fanoutRecord.o
#LIBOBJS += $(EPICS_BASE_BIN)/gsubRecord.o
#LIBOBJS += $(EPICS_BASE_BIN)/histogramRecord.o
LIBOBJS += $(EPICS_BASE_BIN)/longinRecord.o
LIBOBJS += $(EPICS_BASE_BIN)/longoutRecord.o
LIBOBJS += $(EPICS_BASE_BIN)/mbbiRecord.o
LIBOBJS += $(EPICS_BASE_BIN)/mbbiDirectRecord.o
LIBOBJS += $(EPICS_BASE_BIN)/mbboRecord.o
LIBOBJS += $(EPICS_BASE_BIN)/mbboDirectRecord.o
#LIBOBJS += $(EPICS_BASE_BIN)/palRecord.o
LIBOBJS += $(EPICS_BASE_BIN)/permissiveRecord.o
LIBOBJS += $(EPICS_BASE_BIN)/pidRecord.o
#LIBOBJS += $(EPICS_BASE_BIN)/pulseCounterRecord.o
#LIBOBJS += $(EPICS_BASE_BIN)/pulseDelayRecord.o
#LIBOBJS += $(EPICS_BASE_BIN)/pulseTrainRecord.o
#LIBOBJS += $(EPICS_BASE_BIN)/scanRecord.o
#LIBOBJS += $(EPICS_BASE_BIN)/recWaitCa.o
#LIBOBJS += $(EPICS_BASE_BIN)/recDynLink.o
#LIBOBJS += $(EPICS_BASE_BIN)/recDynLinkTest.o
LIBOBJS += $(EPICS_BASE_BIN)/selRecord.o
LIBOBJS += $(EPICS_BASE_BIN)/seqRecord.o
LIBOBJS += $(EPICS_BASE_BIN)/stateRecord.o
#LIBOBJS += $(EPICS_BASE_BIN)/steppermotorRecord.o
LIBOBJS += $(EPICS_BASE_BIN)/stringinRecord.o
LIBOBJS += $(EPICS_BASE_BIN)/stringoutRecord.o
LIBOBJS += $(EPICS_BASE_BIN)/subRecord.o
LIBOBJS += $(EPICS_BASE_BIN)/subArrayRecord.o
#LIBOBJS += $(EPICS_BASE_BIN)/timerRecord.o
#LIBOBJS += $(EPICS_BASE_BIN)/waitRecord.o
LIBOBJS += $(EPICS_BASE_BIN)/waveformRecord.o
#
# Device Support
#
#LIBOBJS += $(EPICS_BASE_BIN)/devAaiCamac.o
#LIBOBJS += $(EPICS_BASE_BIN)/devAiCamac.o
#LIBOBJS += $(EPICS_BASE_BIN)/devAiDvx2502.o
#LIBOBJS += $(EPICS_BASE_BIN)/devAiKscV215.o
LIBOBJS += $(EPICS_BASE_BIN)/devAiSoft.o
LIBOBJS += $(EPICS_BASE_BIN)/devAiSoftRaw.o
LIBOBJS += $(EPICS_BASE_BIN)/devAiSymb.o
LIBOBJS += $(EPICS_BASE_BIN)/devAiTestAsyn.o
#LIBOBJS += $(EPICS_BASE_BIN)/devAiXy566Di.o
#LIBOBJS += $(EPICS_BASE_BIN)/devAiXy566DiL.o
#LIBOBJS += $(EPICS_BASE_BIN)/devAiXy566Se.o
#LIBOBJS += $(EPICS_BASE_BIN)/devAaoCamac.o
#LIBOBJS += $(EPICS_BASE_BIN)/devAoCamac.o
LIBOBJS += $(EPICS_BASE_BIN)/devAoSoft.o
LIBOBJS += $(EPICS_BASE_BIN)/devAoSoftRaw.o
LIBOBJS += $(EPICS_BASE_BIN)/devAoSymb.o
LIBOBJS += $(EPICS_BASE_BIN)/devAoTestAsyn.o
#LIBOBJS += $(EPICS_BASE_BIN)/devAoVmiVme4100.o
#LIBOBJS += $(EPICS_BASE_BIN)/devApsEg.o
#LIBOBJS += $(EPICS_BASE_BIN)/devApsEr.o
#LIBOBJS += $(EPICS_BASE_BIN)/devAt5Vxi.o
#LIBOBJS += $(EPICS_BASE_BIN)/devAt8Fp.o
#LIBOBJS += $(EPICS_BASE_BIN)/devAvme9440.o
#LIBOBJS += $(EPICS_BASE_BIN)/devBiCamac.o
#LIBOBJS += $(EPICS_BASE_BIN)/devBiMpv910.o
LIBOBJS += $(EPICS_BASE_BIN)/devBiSoft.o
LIBOBJS += $(EPICS_BASE_BIN)/devBiSoftRaw.o
LIBOBJS += $(EPICS_BASE_BIN)/devBiTestAsyn.o
#LIBOBJS += $(EPICS_BASE_BIN)/devBiXVme210.o
#LIBOBJS += $(EPICS_BASE_BIN)/devBoCamac.o
#LIBOBJS += $(EPICS_BASE_BIN)/devBoMpv902.o
LIBOBJS += $(EPICS_BASE_BIN)/devBoSoft.o
LIBOBJS += $(EPICS_BASE_BIN)/devBoSoftRaw.o
LIBOBJS += $(EPICS_BASE_BIN)/devBoTestAsyn.o
#LIBOBJS += $(EPICS_BASE_BIN)/devBoXVme220.o
#LIBOBJS += $(EPICS_BASE_BIN)/devCommonGpib.o
LIBOBJS += $(EPICS_BASE_BIN)/devEventSoft.o
LIBOBJS += $(EPICS_BASE_BIN)/devEventTestIoEvent.o
LIBOBJS += $(EPICS_BASE_BIN)/devHistogramSoft.o
LIBOBJS += $(EPICS_BASE_BIN)/devHistogramTestAsyn.o
#LIBOBJS += $(EPICS_BASE_BIN)/devHpe1368a.o
#LIBOBJS += $(EPICS_BASE_BIN)/devLiCamac.o
LIBOBJS += $(EPICS_BASE_BIN)/devLiSoft.o
LIBOBJS += $(EPICS_BASE_BIN)/devLiSymb.o
#LIBOBJS += $(EPICS_BASE_BIN)/devLoCamac.o
LIBOBJS += $(EPICS_BASE_BIN)/devLoSoft.o
LIBOBJS += $(EPICS_BASE_BIN)/devLoSymb.o
#LIBOBJS += $(EPICS_BASE_BIN)/devMbbiCamac.o
#LIBOBJS += $(EPICS_BASE_BIN)/devMbbiDirectCamac.o
#LIBOBJS += $(EPICS_BASE_BIN)/devMbbiDirectMpv910.o
LIBOBJS += $(EPICS_BASE_BIN)/devMbbiDirectSoft.o
LIBOBJS += $(EPICS_BASE_BIN)/devMbbiDirectSoftRaw.o
#LIBOBJS += $(EPICS_BASE_BIN)/devMbbiDirectXVme210.o
#LIBOBJS += $(EPICS_BASE_BIN)/devMbbiMpv910.o
LIBOBJS += $(EPICS_BASE_BIN)/devMbbiSoft.o
LIBOBJS += $(EPICS_BASE_BIN)/devMbbiSoftRaw.o
LIBOBJS += $(EPICS_BASE_BIN)/devMbbiTestAsyn.o
#LIBOBJS += $(EPICS_BASE_BIN)/devMbbiXVme210.o
#LIBOBJS += $(EPICS_BASE_BIN)/devMbboCamac.o
#LIBOBJS += $(EPICS_BASE_BIN)/devMbboDirectCamac.o
#LIBOBJS += $(EPICS_BASE_BIN)/devMbboDirectMpv902.o
LIBOBJS += $(EPICS_BASE_BIN)/devMbboDirectSoft.o
LIBOBJS += $(EPICS_BASE_BIN)/devMbboDirectSoftRaw.o
#LIBOBJS += $(EPICS_BASE_BIN)/devMbboDirectXVme220.o
#LIBOBJS += $(EPICS_BASE_BIN)/devMbboMpv902.o
LIBOBJS += $(EPICS_BASE_BIN)/devMbboSoft.o
LIBOBJS += $(EPICS_BASE_BIN)/devMbboSoftRaw.o
LIBOBJS += $(EPICS_BASE_BIN)/devMbboTestAsyn.o
#LIBOBJS += $(EPICS_BASE_BIN)/devMbboXVme220.o
#LIBOBJS += $(EPICS_BASE_BIN)/devMz8310.o
LIBOBJS += $(EPICS_BASE_BIN)/devPtSoft.o
LIBOBJS += $(EPICS_BASE_BIN)/devSASoft.o
LIBOBJS += $(EPICS_BASE_BIN)/devSiSoft.o
LIBOBJS += $(EPICS_BASE_BIN)/devSiSymb.o
LIBOBJS += $(EPICS_BASE_BIN)/devSiTestAsyn.o
#LIBOBJS += $(EPICS_BASE_BIN)/devSmCompumotor1830.o
#LIBOBJS += $(EPICS_BASE_BIN)/devSmOms6Axis.o
LIBOBJS += $(EPICS_BASE_BIN)/devSoSoft.o
LIBOBJS += $(EPICS_BASE_BIN)/devSoSymb.o
LIBOBJS += $(EPICS_BASE_BIN)/devSoTestAsyn.o
#LIBOBJS += $(EPICS_BASE_BIN)/devSysmon.o
#LIBOBJS += $(EPICS_BASE_BIN)/devTimerMz8310.o
LIBOBJS += $(EPICS_BASE_BIN)/devVxiTDM.o
#LIBOBJS += $(EPICS_BASE_BIN)/devWfCamac.o
#LIBOBJS += $(EPICS_BASE_BIN)/devWfComet.o
#LIBOBJS += $(EPICS_BASE_BIN)/devWfDvx2502.o
#LIBOBJS += $(EPICS_BASE_BIN)/devWfJoergerVtr1.o
LIBOBJS += $(EPICS_BASE_BIN)/devWfSoft.o
LIBOBJS += $(EPICS_BASE_BIN)/devWfTestAsyn.o
#LIBOBJS += $(EPICS_BASE_BIN)/devWfXy566Sc.o
#LIBOBJS += $(EPICS_BASE_BIN)/devWfPentek4261.o
#LIBOBJS += $(EPICS_BASE_BIN)/devXy240.o
#LIBOBJS += $(EPICS_BASE_BIN)/devAB1771IFE.o
#LIBOBJS += $(EPICS_BASE_BIN)/devAB1771IL.o
#LIBOBJS += $(EPICS_BASE_BIN)/devAB1771IR.o
#LIBOBJS += $(EPICS_BASE_BIN)/devAB1771IXE.o
#LIBOBJS += $(EPICS_BASE_BIN)/devAB1771OFE.o
#LIBOBJS += $(EPICS_BASE_BIN)/devABBINARY.o
#LIBOBJS += $(EPICS_BASE_BIN)/devABStatus.o
#LIBOBJS += $(EPICS_BASE_BIN)/devMpc.o
#LIBOBJS += $(EPICS_BASE_BIN)/devAiCan.o
#LIBOBJS += $(EPICS_BASE_BIN)/devAoCan.o
#LIBOBJS += $(EPICS_BASE_BIN)/devBiCan.o
#LIBOBJS += $(EPICS_BASE_BIN)/devBoCan.o
#LIBOBJS += $(EPICS_BASE_BIN)/devMbbiCan.o
#LIBOBJS += $(EPICS_BASE_BIN)/devMbboCan.o
#LIBOBJS += $(EPICS_BASE_BIN)/devMbbiDirectCan.o
#LIBOBJS += $(EPICS_BASE_BIN)/devMbboDirectCan.o
#LIBOBJS += $(EPICS_BASE_BIN)/devVmic2534.o
#
# Driver support ANSI
#
#LIBOBJS += $(EPICS_BASE_BIN)/drvAb.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvAt5Vxi.o
LIBOBJS += $(EPICS_BASE_BIN)/drvEpvxi.o
LIBOBJS += $(EPICS_BASE_BIN)/drvEpvxiMsg.o
LIBOBJS += $(EPICS_BASE_BIN)/drvHp1404a.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvHpe1368a.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvHpe1445a.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvKscV215.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvMz8310.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvStc.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvTime.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvCaenV265.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvVipc310.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvVipc610.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvIpMv162.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvIpac.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvTip810.o
#
# Driver support NON ANSI
#
#LIBOBJS += $(EPICS_BASE_BIN)/module_types.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvBB232.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvBb902.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvBb910.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvBitBus.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvComet.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvCompuSm.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvDvx.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvFp.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvFpm.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvGpib.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvJgvtr1.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvMsg.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvOms.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvTranServ.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvVmi4100.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvXy010.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvXy210.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvXy220.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvXy240.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvXy566.o
#LIBOBJS += $(EPICS_BASE_BIN)/drvVmic2534.o

191
src/db/fast_lock.h Normal file
View 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
View 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*/

View File

@@ -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);
}
@@ -219,7 +219,10 @@ int iocInit(char * pResourceFilename)
if (pinitHooks) (*pinitHooks)(INITHOOKafterFinishDevSup);
scanInit();
asInit();
if(asInit()) {
logMsg("iocInit: asInit Failed during initialization\n",0,0,0,0,0,0);
return(-1);
}
(void)taskDelay(sysClkRateGet()/2);
if (pinitHooks) (*pinitHooks)(INITHOOKafterScanInit);
@@ -1096,11 +1099,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));
}

View File

@@ -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
View 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"

View File

@@ -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
View 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
View 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
View 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
View 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*/

View File

@@ -13,37 +13,45 @@ DEPLIBS_BASE = $(EPICS_BASE_LIB)
DEPLIBS = ./libDb.a\
$(DEPLIBS_BASE)/libCom.a
INC += alarm.h
INC += alarmString.h
INC += dbBase.h
INC += dbFldTypes.h
INC += dbStaticLib.h
INC += link.h
INC += special.h
INC += guigroup.h
SRCS.c = \
dbAsciiYacc.c \
../dbAsciiTest.c\
../dbAsciiExpand.c\
dbYacc.c \
../dbReadTest.c\
../dbExpandInclude.c\
../dbPvdLib.c\
../dbStaticNoRun.c\
../dbStaticLib.c\
../dbAsciiToMenuH.c\
../dbAsciiToRecordtypeH.c
../dbToMenuH.c\
../dbToRecordtypeH.c
OBJS = \
dbAsciiTest.o\
dbAsciiExpand.o\
dbAsciiToMenuH.o\
dbAsciiToRecordtypeH.o
dbReadTest.o\
dbExpandInclude.o\
dbToMenuH.o\
dbToRecordtypeH.o
LIBOBJS = dbStaticLib.o dbAsciiYacc.o dbPvdLib.o dbStaticNoRun.o
LIBOBJS = dbStaticLib.o dbYacc.o dbPvdLib.o dbStaticNoRun.o
LIBNAME = libDb.a
PROD = \
dbAsciiTest\
dbAsciiExpand\
dbAsciiToMenuH\
dbAsciiToRecordtypeH
dbReadTest\
dbExpandInclude\
dbToMenuH\
dbToRecordtypeH
include $(EPICS)/config/RULES.Unix
# Extra rule since dbAsciiRoutines.c is included in dbAsciiYacc.c
dbAsciiYacc.o: dbAsciiLex.c ../dbAsciiRoutines.c
# Extra rule since dbLexRoutines.c is included in dbYacc.c
dbYacc.o: dbLex.c ../dbLexRoutines.c
clean::
@$(RM) dbAsciiLex.c dbAsciiYacc.c
@$(RM) dbLex.c dbYacc.c

View File

@@ -7,13 +7,13 @@ USR_CFLAGS = -ansi
VX_WARN_YES = -Wall -pedantic
SRCS.c = \
dbAsciiYacc.c \
dbYacc.c \
../dbPvdLib.c\
../dbStaticRun.c\
../dbStaticLib.c
OBJSdbLib = \
dbAsciiYacc.o\
dbYacc.o\
dbPvdLib.o\
dbStaticRun.o\
dbStaticLib.o
@@ -22,11 +22,11 @@ PROD = dbStaticLib
include $(EPICS)/config/RULES.Vx
# Extra rule since dbAsciiRoutines.c is included in dbAsciiYacc.c
dbAsciiYacc.o: dbAsciiLex.c ../dbAsciiRoutines.c
# Extra rule since dbLexRoutines.c is included in dbYacc.c
dbYacc.o: dbLex.c ../dbLexRoutines.c
clean::
@$(RM) dbAsciiLex.c dbAsciiYacc.c
@$(RM) dbLex.c dbYacc.c
dbStaticLib: $(OBJSdbLib)
$(RM) $@

173
src/dbStatic/alarm.h Normal file
View File

@@ -0,0 +1,173 @@
/* Alarm definitions (Must Match choiceGbl.ascii) */
/* $Id$ */
/*
* Original Author: Bob Dalesio
* Current Author: Marty Kraimer
* Date: 11-7-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:
* -----------------
* .00 mm-dd-yy iii Comment
* .01 07-16-92 jba changed VALID_ALARM to INVALID_ALARM
* .02 08-11-92 jba added new status DISABLE_ALARM, SIMM_ALARM
* .03 05-11-94 jba added new status READ_ACCESS_ALARM, WRITE_ACCESS_ALARM
* $Log$
* Revision 1.14 1995/10/12 01:25:56 jhill
* added CVS logging
*
*/
#ifndef INCalarmh
#define INCalarmh 1
#include <shareLib.h>
#include <epicsTypes.h>
#ifndef stringOf
#ifdef VAXC
#define stringOf(TOKEN) "TOKEN"
#else
#define stringOf(TOKEN) #TOKEN
#endif
#endif
/* defines for the choice fields */
/* ALARM SEVERITIES - NOTE: must match defs in choiceGbl.ascii GBL_ALARM_SEV */
#define NO_ALARM 0x0
#define MINOR_ALARM 0x1
#define MAJOR_ALARM 0x2
#define INVALID_ALARM 0x3
#define ALARM_NSEV INVALID_ALARM+1
#ifndef NO_ALARMH_ENUM
typedef enum {
epicsSevNone = NO_ALARM,
epicsSevMajor = MINOR_ALARM,
epicsSevInvalid = MAJOR_ALARM
}epicsAlarmSeverity;
#define firstEpicsAlarmSev epicsSevNone
#define lastEpicsAlarmSev epicsSevInvalid
#ifdef epicsAlarmGLOBAL
READONLY char *epicsAlarmSeverityStrings [lastEpicsAlarmSev+1] = {
stringOf (NO_ALARM),
stringOf (MINOR_ALARM),
stringOf (MAJOR_ALARM)
};
#else /*epicsAlarmGLOBAL*/
epicsShareExtern READONLY char *epicsAlarmSeverityStrings [lastEpicsAlarmSev+1];
#endif /*epicsAlarmGLOBAL*/
#endif /* NO_ALARMH_ENUM */
/* ALARM STATUS -NOTE: must match defs in choiceGbl.ascii GBL_ALARM_STAT */
/* NO_ALARM = 0 as above */
#define READ_ALARM 1
#define WRITE_ALARM 2
/* ANALOG ALARMS */
#define HIHI_ALARM 3
#define HIGH_ALARM 4
#define LOLO_ALARM 5
#define LOW_ALARM 6
/* BINARY ALARMS */
#define STATE_ALARM 7
#define COS_ALARM 8
/* other alarms */
#define COMM_ALARM 9
#define TIMEOUT_ALARM 10
#define HW_LIMIT_ALARM 11
#define CALC_ALARM 12
#define SCAN_ALARM 13
#define LINK_ALARM 14
#define SOFT_ALARM 15
#define BAD_SUB_ALARM 16
#define UDF_ALARM 17
#define DISABLE_ALARM 18
#define SIMM_ALARM 19
#define READ_ACCESS_ALARM 20
#define WRITE_ACCESS_ALARM 21
#define ALARM_NSTATUS WRITE_ACCESS_ALARM + 1
#ifndef NO_ALARMH_ENUM
typedef enum {
epicsAlarmRead = READ_ALARM,
epicsAlarmWrite = WRITE_ALARM,
epicsAlarmHiHi = HIHI_ALARM,
epicsAlarmHigh = HIGH_ALARM,
epicsAlarmLoLo = LOLO_ALARM,
epicsAlarmLow = LOW_ALARM,
epicsAlarmState = STATE_ALARM,
epicsAlarmCos = COS_ALARM,
epicsAlarmComm = COMM_ALARM,
epicsAlarmTimeout = TIMEOUT_ALARM,
epicsAlarmHwLimit = HW_LIMIT_ALARM,
epicsAlarmCalc = CALC_ALARM,
epicsAlarmScan = SCAN_ALARM,
epicsAlarmLink = LINK_ALARM,
epicsAlarmSoft = SOFT_ALARM,
epicsAlarmBadSub = BAD_SUB_ALARM,
epicsAlarmUDF = UDF_ALARM,
epicsAlarmDisable = DISABLE_ALARM,
epicsAlarmSimm = SIMM_ALARM,
epicsAlarmReadAccess = READ_ACCESS_ALARM,
epicsAlarmWriteAccess = WRITE_ACCESS_ALARM
}epicsAlarmCondition;
#define firstEpicsAlarmCond epicsSevNone
#define lastEpicsAlarmCond epicsAlarmWriteAccess
#ifdef epicsAlarmGLOBAL
READONLY char *epicsAlarmConditionStrings [lastEpicsAlarmCond+1] = {
stringOf (epicsAlarmRead),
stringOf (epicsAlarmWrite),
stringOf (epicsAlarmHiHi),
stringOf (epicsAlarmHigh),
stringOf (epicsAlarmLoLo),
stringOf (epicsAlarmLow),
stringOf (epicsAlarmState),
stringOf (epicsAlarmCos),
stringOf (epicsAlarmComm),
stringOf (epicsAlarmTimeout),
stringOf (epicsAlarmHwLimit),
stringOf (epicsAlarmCalc),
stringOf (epicsAlarmScan),
stringOf (epicsAlarmLink),
stringOf (epicsAlarmSoft),
stringOf (epicsAlarmBadSub),
stringOf (epicsAlarmUDF),
stringOf (epicsAlarmDisable),
stringOf (epicsAlarmSimm),
stringOf (epicsAlarmReadAccess),
stringOf (epicsAlarmWriteAccess),
};
#else /*epicsAlarmGLOBAL*/
epicsShareExtern READONLY char *epicsAlarmConditionStrings [lastEpicsAlarmCond+1];
#endif /*epicsAlarmGLOBAL*/
#endif /* NO_ALARMH_ENUM */
#endif /* INCalarmh */

View File

@@ -0,0 +1,81 @@
/* $Id$
* Author:
* Date:
*
* 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 06-06-91 bkc Modified alarmSeverityString: add VALID alarm,
* remove INFO alarm
* .02 09-10-91 bkc Change status string corresponding to
* dbconV2/menus.c
* .03 07-16-92 jba changed VALID_ALARM to INVALID_ALARM
* .04 02-03-93 jba added 2 new status values
* .05 05-11-94 jba addd READ_ACCESS, WRITE_ACCESS, rmvd EPICS_V2 ifdef
* ...
*/
/* alarmString.h - String values for alarms (Must match alarm.h)!!!!*/
/* share/epicsH @(#)alarmString.h 1.3 11/6/90 */
#ifndef INCalarmStringh
#define INCalarmStringh 1
static char *alarmStringhSccsId = "$Id$";
char * alarmSeverityString[]={
"NO_ALARM",
"MINOR",
"MAJOR",
"INVALID"
};
/*** note: this should be reconciled with alarm.h ***/
char * alarmStatusString[]={
"NO_ALARM",
"READ",
"WRITE",
"HIHI",
"HIGH",
"LOLO",
"LOW",
"STATE",
"COS",
"COMM",
"TIMEOUT",
"HWLIMIT",
"CALC",
"SCAN",
"LINK",
"SOFT",
"BAD_SUB",
"UDF",
"DISABLE",
"SIMM",
"READ_ACCESS",
"WRITE_ACCESS"};
#endif

145
src/dbStatic/dbBase.h Normal file
View File

@@ -0,0 +1,145 @@
/* $Id$
*
* Current Author: Marty Kraimer
* Date: 03-19-92
*
* 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-19-92 mrk Original
* .02 05-18-92 rcz New database access
* .03 09-21-92 rcz removed #include <dbPvd.h>
*/
#ifndef INCdbBaseh
#define INCdbBaseh 1
#include <dbFldTypes.h>
#include <ellLib.h>
#include <dbDefs.h>
typedef struct dbMenu {
ELLNODE node;
char *name;
int nChoice;
char **papChoiceName;
char **papChoiceValue;
}dbMenu;
typedef struct drvSup {
ELLNODE node;
char *name;
struct drvet *pdrvet;
}drvSup;
typedef struct devSup {
ELLNODE node;
char *name;
char *choice;
int link_type;
/*Following only available on run time system*/
struct dset *pdset;
}devSup;
typedef struct dbDeviceMenu {
int nChoice;
char **papChoice;
}dbDeviceMenu;
/* conversion types*/
typedef enum {CT_DECIMAL,CT_HEX} ctType;
/* access level types */
typedef enum {ASL0,ASL1} asLevel;
/*Breakpoint Tables */
typedef struct brkInt{ /* breakpoint interval */
float raw; /*raw value for beginning of interval */
float slope; /*slope for interval */
float eng; /*converted value for beginning of interval*/
}brkInt;
typedef struct brkTable { /* breakpoint table */
ELLNODE node;
char *name; /*breakpoint table name */
long number; /*number of brkInt in this table*/
struct brkInt **papBrkInt; /* ptr to array of ptr to brkInt */
}brkTable;
typedef struct dbFldDes{ /* field description */
char *prompt; /*Prompt string for DCT*/
char *name; /*Field name*/
char *extra; /*C def for DBF_NOACCESS*/
struct dbRecDes *pdbRecDes;
short indRecDes; /*within dbRecDes.papFldDes */
short special; /*Special processing requirements */
dbfType field_type; /*Field type as defined in dbFldTypes.h */
short process_passive;/*should dbPutField process passive */
ctType base; /*base for integer to string conversions*/
short promptgroup; /*prompt, i.e. gui group */
short interest; /*interest level */
asLevel as_level; /*access security level */
char *initial; /*initial value */
/*If (DBF_MENU,DBF_DEVICE) ftPvt is (pdbMenu,pdbDeviceMenu) */
void *ftPvt;
/*On no runtime following only set for STRING */
short size; /*length in bytes of a field element */
/*The following are only available on run time system*/
short offset; /*Offset in bytes from beginning of record*/
}dbFldDes;
typedef struct dbRecordNode {
ELLNODE node;
void *precord;
char *recordname;
}dbRecordNode;
typedef struct dbRecDes {
ELLNODE node;
ELLLIST recList; /*LIST head of sorted dbRecordNodes*/
ELLLIST devList; /*List of associated device support*/
char *name;
short no_fields; /* number of fields defined */
short no_prompt; /* number of fields to configure*/
short no_links; /* number of links */
short *link_ind; /* addr of array of ind in papFldDes*/
char **papsortFldName;/* ptr to array of ptr to fld names*/
short *sortFldInd; /* addr of array of ind in papFldDes*/
dbFldDes *pvalFldDes; /*pointer dbFldDes for VAL field*/
short indvalFlddes; /*ind in apFldDes*/
dbFldDes **papFldDes; /* ptr to array of ptr to fldDes*/
/*The following are only available on run time system*/
struct rset *prset;
int rec_size; /*record size in bytes */
}dbRecDes;
typedef struct dbBase {
ELLLIST menuList;
ELLLIST recDesList;
ELLLIST drvList;
ELLLIST bptList; /*Break Point Table Head*/
void *pathPvt;
void *ppvd; /* pointer to process variable directory*/
void *pgpHash; /*General purpose Hash Table*/
short ignoreMissingMenus;
}dbBase;
#endif

View File

@@ -1,4 +1,4 @@
/* dbAsciiExpand.c */
/* dbExpandInclude.c */
/* Author: Marty Kraimer Date: 30NOV95 */
/*****************************************************************
COPYRIGHT NOTIFICATION
@@ -30,22 +30,39 @@ DBBASE *pdbbase = NULL;
int main(int argc,char **argv)
{
int arg,strip;
char *path=0;
long status;
int i;
/*Look for path, i.e. -I path or -Ipath*/
for(arg=1; arg<argc; arg++) {
if(strncmp(argv[arg],"-I",2)!=0) continue;
if(strlen(argv[arg])==2) {
path = argv[arg+1];
strip = 2;
} else {
path = argv[arg] + 2;
strip = 1;
}
argc -= strip;
for(i=arg; i<argc; i++) argv[i] = argv[i + strip];
break;
}
if(argc<2) {
printf("usage: dbAsciiExpand file1.ascii fi;e2.ascii ...\n");
printf("usage: dbExpandInclude -Ipath file1.db file2.db ...\n");
exit(0);
}
for(i=1; i<argc; i++) {
status = dbAsciiRead(&pdbbase,argv[i]);
status = dbReadDatabase(&pdbbase,argv[i],path);
if(!status) continue;
epicsPrintf("For input file %s",argv[i]);
errMessage(status,"from dbAsciiInitialize");
fprintf(stderr,"For input file %s",argv[i]);
errMessage(status,"from dbReadDatabase");
}
dbWriteMenu(pdbbase,0);
dbWriteRecDes(pdbbase,0);
dbWriteDevice(pdbbase);
dbWriteDriver(pdbbase);
dbWriteMenuFP(pdbbase,stdout,0);
dbWriteRecDesFP(pdbbase,stdout,0);
dbWriteDeviceFP(pdbbase,stdout);
dbWriteDriverFP(pdbbase,stdout);
dbWriteRecordFP(pdbbase,stdout,0,0);
return(0);
}

100
src/dbStatic/dbFldTypes.h Normal file
View File

@@ -0,0 +1,100 @@
/* $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 mm-dd-yy iii Comment
*/
#ifndef INCdbFldTypesh
#define INCdbFldTypesh 1
/* field types */
typedef enum {
DBF_STRING,
DBF_CHAR,
DBF_UCHAR,
DBF_SHORT,
DBF_USHORT,
DBF_LONG,
DBF_ULONG,
DBF_FLOAT,
DBF_DOUBLE,
DBF_ENUM,
DBF_MENU,
DBF_DEVICE,
DBF_INLINK,
DBF_OUTLINK,
DBF_FWDLINK,
DBF_NOACCESS
}dbfType;
#define DBF_NTYPES DBF_NOACCESS+1
typedef struct mapdbfType{
char *strvalue;
dbfType value;
}mapdbfType;
#ifndef DBFLDTYPES_GBLSOURCE
extern mapdbfType pamapdbfType[];
#else
mapdbfType pamapdbfType[DBF_NTYPES] = {
{"DBF_STRING",DBF_STRING},
{"DBF_CHAR",DBF_CHAR},
{"DBF_UCHAR",DBF_UCHAR},
{"DBF_SHORT",DBF_SHORT},
{"DBF_USHORT",DBF_USHORT},
{"DBF_LONG",DBF_LONG},
{"DBF_ULONG",DBF_ULONG},
{"DBF_FLOAT",DBF_FLOAT},
{"DBF_DOUBLE",DBF_DOUBLE},
{"DBF_ENUM",DBF_ENUM},
{"DBF_MENU",DBF_MENU},
{"DBF_DEVICE",DBF_DEVICE},
{"DBF_INLINK",DBF_INLINK},
{"DBF_OUTLINK",DBF_OUTLINK},
{"DBF_FWDLINK",DBF_FWDLINK},
{"DBF_NOACCESS",DBF_NOACCESS}
};
#endif /*DBFLDTYPES_GBLSOURCE*/
/* data request buffer types */
#define DBR_STRING DBF_STRING
#define DBR_CHAR DBF_CHAR
#define DBR_UCHAR DBF_UCHAR
#define DBR_SHORT DBF_SHORT
#define DBR_USHORT DBF_USHORT
#define DBR_LONG DBF_LONG
#define DBR_ULONG DBF_ULONG
#define DBR_FLOAT DBF_FLOAT
#define DBR_DOUBLE DBF_DOUBLE
#define DBR_ENUM DBF_ENUM
#define DBR_PUT_ACKT DBR_ENUM+1
#define DBR_PUT_ACKS DBR_PUT_ACKT+1
#define DBR_NOACCESS DBF_NOACCESS
#define VALID_DB_REQ(x) ((x >= 0) && (x <= DBR_ENUM))
#define INVALID_DB_REQ(x) ((x < 0) || (x > DBR_ENUM))
#endif /*INCdbFldTypesh*/

View File

@@ -3,7 +3,7 @@ string [a-zA-Z0-9_\,\./\*#\[\]%: ;!|\'\-&\(\)@\?\+<>=\$\t]
%{
#undef YY_INPUT
#define YY_INPUT(b,r,ms) (r=(*dbAscii_yyinput)(b,ms))
#define YY_INPUT(b,r,ms) (r=(*db_yyinput)(b,ms))
static int yyreset(void)
{
@@ -17,6 +17,7 @@ static int yyreset(void)
"include" {return(tokenINCLUDE);}
"path" {return(tokenPATH);}
"addpath" {return(tokenADDPATH);}
"menu" {return(tokenMENU);}
"choice" {return(tokenCHOICE);}
"recordtype" {return(tokenRECORDTYPE);}

View File

@@ -1,4 +1,4 @@
/* dbAsciiRoutines.c */
/* dbLexRoutines.c */
/* Author: Marty Kraimer Date: 13JUL95*/
/*****************************************************************
COPYRIGHT NOTIFICATION
@@ -45,33 +45,33 @@ static void yyerrorAbort(char *str);
static void allocTemp(void *pvoid);
static void *popFirstTemp(void);
static void *getLastTemp(void);
static int dbAscii_yyinput(char *buf,int max_size);
static void dbAsciiIncludePrint(FILE *fp);
static void dbAsciiPath(char *path);
static void dbAsciiIncludeNew(char *include_file);
static void dbAsciiMenuHead(char *name);
static void dbAsciiMenuChoice(char *name,char *value);
static void dbAsciiMenuBody(void);
static int db_yyinput(char *buf,int max_size);
static void dbIncludePrint(FILE *fp);
static void dbPathCmd(char *path);
static void dbAddPathCmd(char *path);
static void dbIncludeNew(char *include_file);
static void dbMenuHead(char *name);
static void dbMenuChoice(char *name,char *value);
static void dbMenuBody(void);
static void dbAsciiRecordtypeHead(char *name);
static void dbAsciiRecordtypeBody(void);
static void dbAsciiRecordtypeFieldHead(char *name,char *type);
static void dbAsciiRecordtypeFieldItem(char *name,char *value);
static void dbRecordtypeHead(char *name);
static void dbRecordtypeBody(void);
static void dbRecordtypeFieldHead(char *name,char *type);
static void dbRecordtypeFieldItem(char *name,char *value);
static void dbAsciiDevice(char *recordtype,char *linktype,
static void dbDevice(char *recordtype,char *linktype,
char *dsetname,char *choicestring);
static void dbAsciiDriver(char *name);
static void dbDriver(char *name);
static void dbAsciiBreakHead(char *name);
static void dbAsciiBreakItem(char *value);
static void dbAsciiBreakBody(void);
static void dbBreakHead(char *name);
static void dbBreakItem(char *value);
static void dbBreakBody(void);
static void dbAsciiRecordHead(char *rectype,char*name);
static void dbAsciiRecordField(char *name,char *value);
static void dbAsciiRecordBody(void);
static void dbRecordHead(char *rectype,char*name);
static void dbRecordField(char *name,char *value);
static void dbRecordBody(void);
/*private declarations*/
static int firstTime = TRUE;
#define MY_BUFFER_SIZE 1024
static char *my_buffer=NULL;
static char *my_buffer_ptr=NULL;
@@ -132,52 +132,81 @@ static void *getLastTemp(void)
return(ptempListNode->item);
}
static long dbAsciiReadCOM(DBBASE **ppdbbase,const char *filename, FILE *fp)
static char *dbOpenFile(DBBASE *pdbbase,const char *filename,FILE **fp)
{
ELLLIST *ppathList = (ELLLIST *)pdbbase->pathPvt;
dbPathNode *pdbPathNode;
char *fullfilename;
*fp = 0;
if(!filename) return(0);
if(!ppathList || (ellCount(ppathList)==0) || strchr(filename,'/')){
*fp = fopen(filename,"r");
return(0);
}
pdbPathNode = (dbPathNode *)ellFirst(ppathList);
while(pdbPathNode) {
fullfilename = dbCalloc(strlen(filename)+strlen(pdbPathNode->directory)
+2,sizeof(char));
strcpy(fullfilename,pdbPathNode->directory);
strcat(fullfilename,"/");
strcat(fullfilename,filename);
*fp = fopen(fullfilename,"r");
free((void *)fullfilename);
if(*fp) return(pdbPathNode->directory);
pdbPathNode = (dbPathNode *)ellNext(&pdbPathNode->node);
}
return(0);
}
static long dbReadCOM(DBBASE **ppdbbase,const char *filename, FILE *fp,
const char *path)
{
long status;
inputFile *pinputFile;
char *penv;
if(*ppdbbase == 0) *ppdbbase = dbAllocBase();
pdbbase = *ppdbbase;
if(path) {
dbPath(pdbbase,path);
} else {
penv = getenv("EPICS_DB_INCLUDE_PATH");
if(penv) {
dbPath(pdbbase,penv);
} else {
dbPath(pdbbase,".");
}
}
my_buffer = dbCalloc(MY_BUFFER_SIZE,sizeof(char));
if(firstTime) {
ellInit(&inputFileList);
ellInit(&tempList);
freeListInitPvt(&freeListPvt,sizeof(tempListNode),5);
firstTime = FALSE;
}
pinputFile = (inputFile *)ellLast(&inputFileList);
while(pinputFile) {
fclose(pinputFile->fp);
free((void *)pinputFile->filename);
free((void *)pinputFile->path);
ellDelete(&inputFileList,(ELLNODE *)pinputFile);
free((void *)pinputFile);
pinputFile = (inputFile *)ellLast(&inputFileList);
}
ellInit(&inputFileList);
ellInit(&tempList);
freeListInitPvt(&freeListPvt,sizeof(tempListNode),5);
pinputFile = dbCalloc(1,sizeof(inputFile));
if(filename) {
pinputFile->filename = dbCalloc(strlen(filename)+1,sizeof(char));
strcpy(pinputFile->filename,filename);
}
if(!fp) {
if(!filename || !(fp = fopen(filename,"r"))) {
FILE *fp;
if(filename) pinputFile->path = dbOpenFile(pdbbase,filename,&fp);
if(!filename || !fp) {
errPrintf(0,__FILE__, __LINE__,
"dbAsciiRead opening file %s\n",filename);
free((void *)pinputFile);
"dbRead opening file %s",filename);
free((void *)my_buffer);
freeListCleanup(freeListPvt);
free((void *)pinputFile);
return(-1);
}
pinputFile->fp = fp;
} else {
pinputFile->fp = fp;
}
pinputFile->fp = fp;
pinputFile->line_num = 0;
pinputFileNow = pinputFile;
my_buffer[0] = '\0';
my_buffer_ptr = my_buffer;
if(*ppdbbase) {
pdbbase = *ppdbbase;
} else {
pdbbase = dbAllocBase();
*ppdbbase = pdbbase;
}
ellAdd(&inputFileList,&pinputFile->node);
status = pvt_yy_parse();
if(status) {
@@ -185,28 +214,25 @@ static long dbAsciiReadCOM(DBBASE **ppdbbase,const char *filename, FILE *fp)
}
freeListCleanup(freeListPvt);
free((void *)my_buffer);
firstTime = TRUE;
return(0);
}
long dbAsciiRead(DBBASE **ppdbbase,const char *filename)
{return (dbAsciiReadCOM(ppdbbase,filename,0));}
long dbReadDatabase(DBBASE **ppdbbase,const char *filename,const char *path)
{return (dbReadCOM(ppdbbase,filename,0,path));}
long dbAsciiReadFP(DBBASE **ppdbbase,FILE *fp)
{return (dbAsciiReadCOM(ppdbbase,0,fp));}
long dbReadDatabaseFP(DBBASE **ppdbbase,FILE *fp,const char *path)
{return (dbReadCOM(ppdbbase,0,fp,path));}
static int dbAscii_yyinput(char *buf, int max_size)
static int db_yyinput(char *buf, int max_size)
{
int l,n;
if(*my_buffer_ptr==0) {
while(fgets(my_buffer,MY_BUFFER_SIZE,pinputFileNow->fp)==NULL) {
if(fclose(pinputFileNow->fp))
errPrintf(0,__FILE__, __LINE__,
"Closing file %s\n",pinputFileNow->filename);
"Closing file %s",pinputFileNow->filename);
free((void *)pinputFileNow->filename);
free((void *)pinputFileNow->path);
ellDelete(&inputFileList,(ELLNODE *)pinputFileNow);
free((void *)pinputFileNow);
pinputFileNow = (inputFile *)ellLast(&inputFileList);
@@ -223,21 +249,21 @@ static int dbAscii_yyinput(char *buf, int max_size)
return(n);
}
static void dbAsciiIncludePrint(FILE *fp)
static void dbIncludePrint(FILE *fp)
{
inputFile *pinputFile = pinputFileNow;
fprintf(fp,"input line: %s",my_buffer);
while(pinputFile) {
if(pinputFile->filename) {
fprintf(fp," in file: ");
fprintf(fp," in:");
if(pinputFile->path)
fprintf(fp," path \"%s\"",pinputFile->path);
fprintf(fp,"%s",pinputFile->filename);
fprintf(fp," path \"%s\" ",pinputFile->path);
fprintf(fp," file %s",pinputFile->filename);
} else {
fprintf(fp," stdin:");
fprintf(fp,"stdin:");
if(pinputFile->path)
fprintf(fp," path \"%s\"",pinputFile->path);
fprintf(fp," path \"%s\" ",pinputFile->path);
}
fprintf(fp," line %d\n",pinputFile->line_num);
pinputFile = (inputFile *)ellPrevious(&pinputFile->node);
@@ -246,104 +272,59 @@ static void dbAsciiIncludePrint(FILE *fp)
return;
}
static void dbAsciiPath(char *path)
static void dbPathCmd(char *path)
{
pinputFileNow->path = path;
dbPath(pdbbase,path);
free((void *)path);
}
static void dbAddPathCmd(char *path)
{
dbAddPath(pdbbase,path);
free((void *)path);
}
static void dbAsciiIncludeNew(char *filename)
static void dbIncludeNew(char *filename)
{
inputFile *newfile;
inputFile *pinputFile;
inputFile *pinputFileFirst;
FILE *fp;
char *currentPath;
char *newCurrentPath;
int lenPathAndFilename = 0;
int lenstr;
newfile = dbCalloc(1,sizeof(inputFile));
newfile->filename = dbCalloc(strlen(filename)+1,sizeof(char));
strcpy(newfile->filename,filename);
/*search backward for first path starting with / */
pinputFile = (inputFile *)ellLast(&inputFileList);
while(pinputFile) {
if(pinputFile->path) {
if(pinputFile->path[0]=='/') break;
}
pinputFile = (inputFile *)ellPrevious(&pinputFile->node);
}
if(!pinputFile) pinputFile=(inputFile *)ellFirst(&inputFileList);
pinputFileFirst = pinputFile;
while(pinputFile) {
if(pinputFile->path) {
lenstr = strlen(pinputFile->path);
lenPathAndFilename += lenstr;
if(pinputFile->path[lenstr-1] != '/') lenPathAndFilename++;
}
pinputFile = (inputFile *)ellNext(&pinputFile->node);
}
lenPathAndFilename += strlen(filename) + 1;
currentPath = dbCalloc(lenPathAndFilename,sizeof(char));
pinputFile = pinputFileFirst;
while(pinputFile) {
if(pinputFile->path) {
strcat(currentPath,pinputFile->path);
lenstr = strlen(pinputFile->path);
if(pinputFile->path[lenstr-1] != '/') strcat(currentPath,"/");
}
pinputFile = (inputFile *)ellNext(&pinputFile->node);
}
strcat(currentPath,filename);
fp = fopen(currentPath,"r");
if(!fp) { /*Try preceeding path with ./rec */
newCurrentPath = dbCalloc(
(strlen("./rec/") + strlen(currentPath) + 1),sizeof(char));
strcpy(newCurrentPath,"./rec/");
strcat(newCurrentPath,currentPath);
fp = fopen(newCurrentPath,"r");
free((void *)newCurrentPath);
}
if(!fp) { /*Try preceeding path with ./base/rec */
newCurrentPath = dbCalloc(
(strlen("./base/rec/") + strlen(currentPath) + 1),sizeof(char));
strcpy(newCurrentPath,"./base/rec/");
strcat(newCurrentPath,currentPath);
fp = fopen(newCurrentPath,"r");
free((void *)newCurrentPath);
}
pinputFile = dbCalloc(1,sizeof(inputFile));
pinputFile->path = dbOpenFile(pdbbase,filename,&fp);
if(!fp) {
errPrintf(0,__FILE__, __LINE__,
"dbAsciiIncludeNew opening file %s\n",currentPath);
"dbIncludeNew opening file %s",filename);
yyerror(NULL);
free((void *)filename);
free((void *)newfile);
free((void *)pinputFile);
return;
}
free((void *)currentPath);
pinputFile->filename = dbCalloc(strlen(filename)+1,sizeof(char));
strcpy(pinputFile->filename,filename);
free((void *)filename);
newfile->fp = fp;
ellAdd(&inputFileList,&newfile->node);
pinputFileNow = newfile;
pinputFile->fp = fp;
ellAdd(&inputFileList,&pinputFile->node);
pinputFileNow = pinputFile;
}
static void dbAsciiMenuHead(char *name)
static void dbMenuHead(char *name)
{
dbMenu *pdbMenu;
GPHENTRY *pgphentry;
pgphentry = gphFind(pdbbase->pgpHash,name,&pdbbase->menuList);
if(pgphentry) {
yyerror("Duplicate menu ignored");
duplicate = TRUE;
free((void *)name);
return;
}
pdbMenu = dbCalloc(1,sizeof(dbMenu));
pdbMenu->name = name;
if(ellCount(&tempList)) yyerrorAbort("dbAsciiMenuHead: tempList not empty");
if(ellCount(&tempList)) yyerrorAbort("dbMenuHead: tempList not empty");
allocTemp(pdbMenu);
}
static void dbAsciiMenuChoice(char *name,char *value)
static void dbMenuChoice(char *name,char *value)
{
if(duplicate) {
free((void *)name);
@@ -354,7 +335,7 @@ static void dbAsciiMenuChoice(char *name,char *value)
allocTemp(value);
}
static void dbAsciiMenuBody(void)
static void dbMenuBody(void)
{
dbMenu *pnewMenu;
dbMenu *pMenu;
@@ -374,7 +355,7 @@ static void dbAsciiMenuBody(void)
pnewMenu->papChoiceName[i] = (char *)popFirstTemp();
pnewMenu->papChoiceValue[i] = (char *)popFirstTemp();
}
if(ellCount(&tempList)) yyerrorAbort("dbAsciiMenuBody: tempList not empty");
if(ellCount(&tempList)) yyerrorAbort("dbMenuBody: tempList not empty");
/* Add menu in sorted order */
pMenu = (dbMenu *)ellFirst(&pdbbase->menuList);
while(pMenu && strcmp(pMenu->name,pnewMenu->name) >0 )
@@ -391,24 +372,25 @@ static void dbAsciiMenuBody(void)
}
}
static void dbAsciiRecordtypeHead(char *name)
static void dbRecordtypeHead(char *name)
{
dbRecDes *pdbRecDes;
GPHENTRY *pgphentry;
pgphentry = gphFind(pdbbase->pgpHash,name,&pdbbase->recDesList);
if(pgphentry) {
yyerror("Duplicate recordtype ignored");
duplicate = TRUE;
free((void *)name);
return;
}
pdbRecDes = dbCalloc(1,sizeof(dbRecDes));
pdbRecDes->name = name;
if(ellCount(&tempList))
yyerrorAbort("dbAsciiRecordtypeHead tempList not empty");
yyerrorAbort("dbRecordtypeHead tempList not empty");
allocTemp(pdbRecDes);
}
static void dbAsciiRecordtypeFieldHead(char *name,char *type)
static void dbRecordtypeFieldHead(char *name,char *type)
{
dbFldDes *pdbFldDes;
int i;
@@ -433,7 +415,7 @@ static void dbAsciiRecordtypeFieldHead(char *name,char *type)
yyerrorAbort("Illegal Field Type");
}
static void dbAsciiRecordtypeFieldItem(char *name,char *value)
static void dbRecordtypeFieldItem(char *name,char *value)
{
dbFldDes *pdbFldDes;
@@ -549,7 +531,7 @@ static void dbAsciiRecordtypeFieldItem(char *name,char *value)
}
}
static void dbAsciiRecordtypeBody(void)
static void dbRecordtypeBody(void)
{
dbRecDes *pdbRecDes;
dbFldDes *pdbFldDes;
@@ -587,7 +569,7 @@ static void dbAsciiRecordtypeBody(void)
fprintf(stderr,"recordtype(%s).%s extra not specified\n",
pdbRecDes->name,pdbFldDes->name);
}
if(ellCount(&tempList)) yyerrorAbort("dbAsciiMenuBody: tempList not empty");
if(ellCount(&tempList)) yyerrorAbort("dbMenuBody: tempList not empty");
pdbRecDes->no_prompt = no_prompt;
pdbRecDes->no_links = no_links;
pdbRecDes->link_ind = dbCalloc(no_prompt,sizeof(short));
@@ -632,7 +614,7 @@ static void dbAsciiRecordtypeBody(void)
dbGetRecordtypeSizeOffset(pdbRecDes);
}
static void dbAsciiDevice(char *recordtype,char *linktype,
static void dbDevice(char *recordtype,char *linktype,
char *dsetname,char *choicestring)
{
devSup *pdevSup;
@@ -643,6 +625,10 @@ static void dbAsciiDevice(char *recordtype,char *linktype,
pgphentry = gphFind(pdbbase->pgpHash,recordtype,&pdbbase->recDesList);
if(!pgphentry) {
yyerror(" record type not found");
free((void *)recordtype);
free((void *)linktype);
free((void *)dsetname);
free((void *)choicestring);
return;
}
free(recordtype);
@@ -661,7 +647,6 @@ static void dbAsciiDevice(char *recordtype,char *linktype,
pdbRecDes = (dbRecDes *)pgphentry->userPvt;
pgphentry = gphFind(pdbbase->pgpHash,choicestring,&pdbRecDes->devList);
if(pgphentry) {
yyerror("Duplicate Device Support ignored");
free((void *)dsetname);
free((void *)choicestring);
return;
@@ -678,15 +663,15 @@ static void dbAsciiDevice(char *recordtype,char *linktype,
}
ellAdd(&pdbRecDes->devList,&pdevSup->node);
}
static void dbAsciiDriver(char *name)
static void dbDriver(char *name)
{
drvSup *pdrvSup;
GPHENTRY *pgphentry;
pgphentry = gphFind(pdbbase->pgpHash,name,&pdbbase->drvList);
if(pgphentry) {
yyerror("Duplicate driver ignored");
free((void *)name);
return;
}
pdrvSup = dbCalloc(1,sizeof(drvSup));
@@ -699,22 +684,23 @@ static void dbAsciiDriver(char *name)
ellAdd(&pdbbase->drvList,&pdrvSup->node);
}
static void dbAsciiBreakHead(char *name)
static void dbBreakHead(char *name)
{
brkTable *pbrkTable;
GPHENTRY *pgphentry;
pgphentry = gphFind(pdbbase->pgpHash,name,&pdbbase->bptList);
if(pgphentry) {
yyerror("Duplicate breakpoint table ignored");
duplicate = TRUE;
free((void *)name);
return;
}
pbrkTable = dbCalloc(1,sizeof(brkTable));
pbrkTable->name = name;
if(ellCount(&tempList)) yyerrorAbort("dbAsciiBreakHead:tempList not empty"); allocTemp(pbrkTable);
if(ellCount(&tempList)) yyerrorAbort("dbBreakHead:tempList not empty"); allocTemp(pbrkTable);
}
static void dbAsciiBreakItem(char *value)
static void dbBreakItem(char *value)
{
if(duplicate) {
free((void *)value);
@@ -722,8 +708,8 @@ static void dbAsciiBreakItem(char *value)
}
allocTemp(value);
}
static void dbAsciiBreakBody(void)
static void dbBreakBody(void)
{
brkTable *pnewbrkTable;
brkTable *pbrkTable;
@@ -738,7 +724,7 @@ static void dbAsciiBreakBody(void)
pnewbrkTable = (brkTable *)popFirstTemp();
pnewbrkTable->number = number = ellCount(&tempList)/2;
if(number*2 != ellCount(&tempList))
yyerrorAbort("dbAsciiBreakBody: Odd number of values");
yyerrorAbort("dbBreakBody: Odd number of values");
pnewbrkTable->papBrkInt = dbCalloc(number,sizeof(brkInt));
for(i=0; i<number; i++) {
double raw,eng;
@@ -748,7 +734,7 @@ static void dbAsciiBreakBody(void)
praw = (char *)popFirstTemp();
peng = (char *)popFirstTemp();
if((sscanf(praw,"%lf",&raw)!=1) || (sscanf(peng,"%lf",&eng)!=1) ) {
yyerrorAbort("dbAsciibrkTable: Illegal table value");
yyerrorAbort("dbbrkTable: Illegal table value");
}
free((void *)praw);
free((void *)peng);
@@ -788,14 +774,14 @@ static void dbAsciiBreakBody(void)
if(!pbrkTable) ellAdd(&pdbbase->bptList,&pnewbrkTable->node);
}
static void dbAsciiRecordHead(char *rectype,char *name)
static void dbRecordHead(char *rectype,char *name)
{
DBENTRY *pdbentry;
long status;
pdbentry = dbAllocEntry(pdbbase);
if(ellCount(&tempList))
yyerrorAbort("dbAsciiRecordHead: tempList not empty");
yyerrorAbort("dbRecordHead: tempList not empty");
allocTemp(pdbentry);
status = dbFindRecdes(pdbentry,rectype);
if(status) {
@@ -805,9 +791,11 @@ static void dbAsciiRecordHead(char *rectype,char *name)
}
/*Duplicate records ok. Thus dont check return status.*/
dbCreateRecord(pdbentry,name);
free((void *)rectype);
free((void *)name);
}
static void dbAsciiRecordField(char *name,char *value)
static void dbRecordField(char *name,char *value)
{
DBENTRY *pdbentry;
tempListNode *ptempListNode;
@@ -827,14 +815,16 @@ static void dbAsciiRecordField(char *name,char *value)
yyerror(NULL);
return;
}
free((void *)name);
free((void *)value);
}
static void dbAsciiRecordBody(void)
static void dbRecordBody(void)
{
DBENTRY *pdbentry;
pdbentry = (DBENTRY *)popFirstTemp();
if(ellCount(&tempList))
yyerrorAbort("dbAsciiRecordBody: tempList not empty");
yyerrorAbort("dbRecordBody: tempList not empty");
dbFreeEntry(pdbentry);
}

View File

@@ -84,7 +84,7 @@ static unsigned short hash( char *pname, int length)
return((ind1<<dbPvdHashTableShift) ^ ind0);
}
int dbPvdTableSize(DBBASE *pdbbase,int size)
int dbPvdTableSize(int size)
{
int i;

View File

@@ -1,4 +1,4 @@
/* asciiTest.c */
/* dbReadTest.c */
/* Author: Marty Kraimer Date: 13JUL95 */
/*****************************************************************
COPYRIGHT NOTIFICATION
@@ -32,16 +32,32 @@ int main(int argc,char **argv)
{
long status;
int i;
int arg,strip;
char *path=0;
/*Look for path, i.e. -I path or -Ipath*/
for(arg=1; arg<argc; arg++) {
if(strncmp(argv[arg],"-I",2)!=0) continue;
if(strlen(argv[arg])==2) {
path = argv[arg+1];
strip = 2;
} else {
path = argv[arg] + 2;
strip = 1;
}
argc -= strip;
for(i=arg; i<argc; i++) argv[i] = argv[i + strip];
break;
}
if(argc<2) {
printf("usage: dbAsciiTest file1.ascii fi;e2.ascii ...\n");
printf("usage: dbReadTest file1.db file2.db ...\n");
exit(0);
}
for(i=1; i<argc; i++) {
status = dbAsciiRead(&pdbbase,argv[i]);
status = dbReadDatabase(&pdbbase,argv[i],path);
if(!status) continue;
epicsPrintf("For input file %s",argv[i]);
errMessage(status,"from dbAsciiInitialize");
fprintf(stderr,"For input file %s",argv[i]);
errMessage(status,"from dbReadDatabase");
}
/*
dbDumpRecDes(pdbbase,"ai");
@@ -49,7 +65,7 @@ int main(int argc,char **argv)
dbPvdDump(pdbbase);
gphDump(pdbbase->pgpHash);
dbDumpMenu(pdbbase,NULL);
dbDumpRecords(pdbbase,NULL,0);
dbDumpRecord(pdbbase,NULL,0);
*/
dbFreeBase(pdbbase);
return(0);

View File

@@ -45,7 +45,6 @@ of this distribution.
#include <dbStaticPvt.h>
#include <devSup.h>
#include <drvSup.h>
#include <cvtTable.h>
#include <special.h>
#include <gpHash.h>
#include <guigroup.h>
@@ -134,6 +133,23 @@ static char **promptAddr[VXI_IO+1];
static int formlines[VXI_IO+1];
/* internal routines*/
static void dbFreePath(DBBASE *pdbbase) {
ELLLIST *ppathList;
dbPathNode *pdbPathNode;
if(!pdbbase) return;
ppathList = (ELLLIST *)pdbbase->pathPvt;
if(!ppathList) return;
while(pdbPathNode = (dbPathNode *)ellFirst(ppathList)) {
ellDelete(ppathList,&pdbPathNode->node);
free((void *)pdbPathNode->directory);
free((void *)pdbPathNode);
}
free((void *)ppathList);
pdbbase->pathPvt = 0;
return;
}
static void initForms(void)
{
static int firstTime=TRUE;
@@ -298,7 +314,7 @@ void dbFreeBase(dbBase *pdbbase)
pdbRecordNode = (dbRecordNode *)ellFirst(&pdbRecDes->recList);
while(pdbRecordNode) {
pdbRecordNodeNext = (dbRecordNode *)ellNext(&pdbRecordNode->node);
if(dbFindRecord(&dbentry,pdbRecordNode->recordname))
if(!dbFindRecord(&dbentry,pdbRecordNode->recordname))
dbDeleteRecord(&dbentry);
pdbRecordNode = pdbRecordNodeNext;
}
@@ -379,6 +395,7 @@ void dbFreeBase(dbBase *pdbbase)
}
gphFreeMem(pdbbase->pgpHash);
dbPvdFreeMem(pdbbase);
dbFreePath(pdbbase);
free((void *)pdbbase);
return;
}
@@ -423,15 +440,68 @@ DBENTRY *dbCopyEntry(DBENTRY *pdbentry)
long dbRead(DBBASE *pdbbase,FILE *fp)
{
return(dbAsciiReadFP(&pdbbase,fp));
return(dbReadDatabaseFP(&pdbbase,fp,0));
}
long dbWrite(DBBASE *pdbbase,FILE *fpdctsdr,FILE *fp)
{
epicsPrintf("dbWrite obsolete. It does NOTHING\n");
fprintf(stderr,"dbWrite obsolete. It does NOTHING\n");
return(-1);
}
long dbPath(DBBASE *pdbbase,const char *path)
{
if(!pdbbase) return(-1);
dbFreePath(pdbbase);
return(dbAddPath(pdbbase,path));
}
long dbWriteRecords(DBBASE *pdbbase,FILE *fp,char *precdesname,int level)
long dbAddPath(DBBASE *pdbbase,const char *path)
{
ELLLIST *ppathList;
dbPathNode *pdbPathNode;
const char *pcolon;
const char *pdir;
int len;
if(!pdbbase) return(-1);
ppathList = (ELLLIST *)pdbbase->pathPvt;
if(!ppathList) {
ppathList= dbCalloc(1,sizeof(ELLLIST));
ellInit(ppathList);
pdbbase->pathPvt = (void *)ppathList;
}
pdir = path;
while(pdir) {
if(*pdir == ':') {
pdir++;
continue;
}
pdbPathNode = (dbPathNode *)dbCalloc(1,sizeof(dbPathNode));
ellAdd(ppathList,&pdbPathNode->node);
pcolon = strchr(pdir,':');
len = (pcolon ? (pcolon - pdir) : strlen(pdir));
pdbPathNode->directory = (char *)dbCalloc(1,len + 1);
strncpy(pdbPathNode->directory,pdir,len);
pdir = (pcolon ? (pcolon+1) : 0);
}
return(0);
}
long dbWriteRecord(DBBASE *ppdbbase,const char *filename,
char *precdesname,int level)
{
FILE *outFile;
outFile = fopen(filename,"w");
if(!outFile) {
errPrintf(0,__FILE__,__LINE__,"Error opening %s\n",filename);
return(-1);
}
dbWriteRecordFP(ppdbbase,outFile,precdesname,level);
return(fclose(outFile));
}
long dbWriteRecordFP(DBBASE *pdbbase,FILE *fp,char *precdesname,int level)
{
DBENTRY dbentry;
DBENTRY *pdbentry=&dbentry;
@@ -440,18 +510,24 @@ long dbWriteRecords(DBBASE *pdbbase,FILE *fp,char *precdesname,int level)
dctonly = ((level>1) ? FALSE : TRUE);
dbInitEntry(pdbbase,pdbentry);
if(!precdesname)
if(!precdesname) {
status = dbFirstRecdes(pdbentry);
else
if(status) {
fprintf(stderr,"dbWriteRecordFP: No record descriptions\n");
return(status);
}
} else {
status = dbFindRecdes(pdbentry,precdesname);
if(status) {
fprintf(stderr,"No record description\n");
return(status);
if(status) {
fprintf(stderr,"dbWriteRecordFP: No record description for %s\n",
precdesname);
return(status);
}
}
while(!status) {
status = dbFirstRecord(pdbentry);
while(!status) {
fprintf(fp,"record(%s,%s) {\n",
fprintf(fp,"record(%s,\"%s\") {\n",
dbGetRecdesName(pdbentry),dbGetRecordName(pdbentry));
status = dbFirstFielddes(pdbentry,dctonly);
while(!status) {
@@ -471,15 +547,31 @@ long dbWriteRecords(DBBASE *pdbbase,FILE *fp,char *precdesname,int level)
return(0);
}
void dbWriteMenu(DBBASE *pdbbase,char *menuName)
long dbWriteMenu(DBBASE *ppdbbase,const char *filename,char *menuName)
{
FILE *outFile;
outFile = fopen(filename,"w");
if(!outFile) {
errPrintf(0,__FILE__,__LINE__,"Error opening %s\n",filename);
return(-1);
}
dbWriteMenuFP(ppdbbase,outFile,menuName);
if(fclose(outFile)) {
errPrintf(0,__FILE__,__LINE__,"Error closing %s\n",filename);
}
return(0);
}
long dbWriteMenuFP(DBBASE *pdbbase,FILE *fp,char *menuName)
{
dbMenu *pdbMenu;
int gotMatch;
int i;
if(!pdbbase) {
printf("pdbbase not specified\n");
return;
fprintf(stderr,"pdbbase not specified\n");
return(-1);
}
pdbMenu = (dbMenu *)ellFirst(&pdbbase->menuList);
while(pdbMenu) {
@@ -489,19 +581,36 @@ void dbWriteMenu(DBBASE *pdbbase,char *menuName)
gotMatch=TRUE;
}
if(gotMatch) {
fprintf(stdout,"menu(%s) {\n",pdbMenu->name);
fprintf(fp,"menu(%s) {\n",pdbMenu->name);
for(i=0; i<pdbMenu->nChoice; i++) {
fprintf(stdout,"\tchoice(%s,\"%s\")\n",pdbMenu->papChoiceName[i],
fprintf(fp,"\tchoice(%s,\"%s\")\n",pdbMenu->papChoiceName[i],
pdbMenu->papChoiceValue[i]);
}
fprintf(stdout,"}\n");
fprintf(fp,"}\n");
if(menuName) break;
}
pdbMenu = (dbMenu *)ellNext(&pdbMenu->node);
}
return(0);
}
void dbWriteRecDes(DBBASE *pdbbase,char *recdesName)
long dbWriteRecDes(DBBASE *pdbbase,const char *filename,char *recdesName)
{
FILE *outFile;
outFile = fopen(filename,"w");
if(!outFile) {
errPrintf(0,__FILE__,__LINE__,"Error opening %s\n",filename);
return(-1);
}
dbWriteRecDesFP(pdbbase,outFile,recdesName);
if(fclose(outFile)) {
errPrintf(0,__FILE__,__LINE__,"Error closing %s\n",filename);
}
return(0);
}
long dbWriteRecDesFP(DBBASE *pdbbase,FILE *fp,char *recdesName)
{
dbRecDes *pdbRecDes;
dbFldDes *pdbFldDes;
@@ -509,8 +618,8 @@ void dbWriteRecDes(DBBASE *pdbbase,char *recdesName)
int i;
if(!pdbbase) {
printf("pdbbase not specified\n");
return;
fprintf(stderr,"pdbbase not specified\n");
return(-1);
}
for(pdbRecDes = (dbRecDes *)ellFirst(&pdbbase->recDesList);
pdbRecDes; pdbRecDes = (dbRecDes *)ellNext(&pdbRecDes->node)) {
@@ -520,27 +629,28 @@ void dbWriteRecDes(DBBASE *pdbbase,char *recdesName)
gotMatch=TRUE;
}
if(!gotMatch) continue;
fprintf(stdout,"recordtype(%s) {\n",pdbRecDes->name);
fprintf(fp,"recordtype(%s) {\n",pdbRecDes->name);
for(i=0; i<pdbRecDes->no_fields; i++) {
int j;
pdbFldDes = pdbRecDes->papFldDes[i];
fprintf(stdout,"\tfield(%s,",pdbFldDes->name);
fprintf(fp,"\tfield(%s,",pdbFldDes->name);
for(j=0; j<DBF_NTYPES; j++) {
if(pamapdbfType[j].value == pdbFldDes->field_type) break;
}
if(j>=DBF_NTYPES)
printf("\t field_type: %d\n", pdbFldDes->field_type);
fprintf(stderr,"\t field_type: %d\n",
pdbFldDes->field_type);
else
fprintf(stdout,"%s) {\n",pamapdbfType[j].strvalue);
fprintf(fp,"%s) {\n",pamapdbfType[j].strvalue);
if(pdbFldDes->prompt)
fprintf(stdout,"\t\tprompt(\"%s\")\n",pdbFldDes->prompt);
fprintf(fp,"\t\tprompt(\"%s\")\n",pdbFldDes->prompt);
if(pdbFldDes->initial)
fprintf(stdout,"\t\tinitial(\"%s\")\n",pdbFldDes->initial);
fprintf(fp,"\t\tinitial(\"%s\")\n",pdbFldDes->initial);
if(pdbFldDes->promptgroup) {
for(j=0; j<GUI_NTYPES; j++) {
if(pamapguiGroup[j].value == pdbFldDes->promptgroup) {
fprintf(stdout,"\t\tpromptgroup(%s)\n",
fprintf(fp,"\t\tpromptgroup(%s)\n",
pamapguiGroup[j].strvalue);
break;
}
@@ -549,45 +659,62 @@ void dbWriteRecDes(DBBASE *pdbbase,char *recdesName)
if(pdbFldDes->special) {
for(j=0; j<SPC_NTYPES; j++) {
if(pamapspcType[j].value == pdbFldDes->special) {
fprintf(stdout,"\t\tspecial(%s)\n",
fprintf(fp,"\t\tspecial(%s)\n",
pamapspcType[j].strvalue);
break;
}
}
}
if(pdbFldDes->extra)
fprintf(stdout,"\t\textra(\"%s\")\n",pdbFldDes->extra);
fprintf(fp,"\t\textra(\"%s\")\n",pdbFldDes->extra);
if(pdbFldDes->field_type==DBF_MENU) {
if(pdbFldDes->ftPvt)
fprintf(stdout,"\t\tmenu(%s)\n",
fprintf(fp,"\t\tmenu(%s)\n",
((dbMenu *)pdbFldDes->ftPvt)->name);
else
printf("\t\t menu: NOT FOUND\n");
fprintf(stderr,"\t\t menu: NOT FOUND\n");
}
if(pdbFldDes->field_type==DBF_STRING) {
fprintf(stdout,"\t\tsize(%d)\n",
fprintf(fp,"\t\tsize(%d)\n",
pdbFldDes->size);
}
if(pdbFldDes->process_passive) fprintf(stdout,"\t\tpp(TRUE)\n");
if(pdbFldDes->base) fprintf(stdout,"\t\tbase(HEX)\n");
if(pdbFldDes->process_passive) fprintf(fp,"\t\tpp(TRUE)\n");
if(pdbFldDes->base) fprintf(fp,"\t\tbase(HEX)\n");
if(pdbFldDes->interest)
fprintf(stdout,"\t\tinterest(%d)\n",pdbFldDes->interest);
if(!pdbFldDes->as_level) fprintf(stdout,"\t\tasl(ASL0)\n");
fprintf(stdout,"\t}\n");
fprintf(fp,"\t\tinterest(%d)\n",pdbFldDes->interest);
if(!pdbFldDes->as_level) fprintf(fp,"\t\tasl(ASL0)\n");
fprintf(fp,"\t}\n");
}
fprintf(stdout,"}\n");
fprintf(fp,"}\n");
if(recdesName) break;
}
return(0);
}
void dbWriteDevice(DBBASE *pdbbase)
long dbWriteDevice(DBBASE *pdbbase,const char *filename)
{
FILE *outFile;
outFile = fopen(filename,"w");
if(!outFile) {
errPrintf(0,__FILE__,__LINE__,"Error opening %s\n",filename);
return(-1);
}
dbWriteDeviceFP(pdbbase,outFile);
if(fclose(outFile)) {
errPrintf(0,__FILE__,__LINE__,"Error closing %s\n",filename);
}
return(0);
}
long dbWriteDeviceFP(DBBASE *pdbbase,FILE *fp)
{
dbRecDes *pdbRecDes;
devSup *pdevSup;
if(!pdbbase) {
printf("pdbbase not specified\n");
return;
fprintf(stderr,"dbWriteDeviceFP: pdbbase not specified\n");
return(-1);
}
for(pdbRecDes = (dbRecDes *)ellFirst(&pdbbase->recDesList);
pdbRecDes; pdbRecDes = (dbRecDes *)ellNext(&pdbRecDes->node)) {
@@ -599,29 +726,47 @@ void dbWriteDevice(DBBASE *pdbbase)
if(pamaplinkType[j].value==pdevSup->link_type) break;
}
if(j>=LINK_NTYPES) {
fprintf(stdout,"link_type not valid\n");
fprintf(fp,"link_type not valid\n");
continue;
}
fprintf(stdout,"device(%s,%s,%s,\"%s\")\n",
fprintf(fp,"device(%s,%s,%s,\"%s\")\n",
pdbRecDes->name,
pamaplinkType[j].strvalue,
pdevSup->name,pdevSup->choice);
}
}
return(0);
}
void dbWriteDriver(DBBASE *pdbbase)
long dbWriteDriver(DBBASE *pdbbase,const char *filename)
{
FILE *outFile;
outFile = fopen(filename,"w");
if(!outFile) {
errPrintf(0,__FILE__,__LINE__,"Error opening %s\n",filename);
return(-1);
}
dbWriteDriverFP(pdbbase,outFile);
if(fclose(outFile)) {
errPrintf(0,__FILE__,__LINE__,"Error closing %s\n",filename);
}
return(0);
}
long dbWriteDriverFP(DBBASE *pdbbase,FILE *fp)
{
drvSup *pdrvSup;
if(!pdbbase) {
printf("pdbbase not specified\n");
return;
fprintf(stderr,"pdbbase not specified\n");
return(-1);
}
for(pdrvSup = (drvSup *)ellFirst(&pdbbase->drvList);
pdrvSup; pdrvSup = (drvSup *)ellNext(&pdrvSup->node)) {
fprintf(stdout,"driver(%s)\n",pdrvSup->name);
fprintf(fp,"driver(%s)\n",pdrvSup->name);
}
return(0);
}
long dbFindRecdes(DBENTRY *pdbentry,char *rectype)
@@ -714,10 +859,10 @@ long dbDeleteRecord(DBENTRY *pdbentry)
long status;
if (!precnode) return (S_dbLib_recNotFound);
if(status = dbFreeRecord(pdbentry)) return(status);
preclist = &precdes->recList;
ellDelete(preclist,&precnode->node);
dbPvdDelete(pdbbase,precnode);
if(status = dbFreeRecord(pdbentry)) return(status);
free((void *)precnode);
pdbentry->precnode = NULL;
return (0);
@@ -747,6 +892,11 @@ long dbFindRecord(DBENTRY *pdbentry,char *precordName)
if(*precordName++=='.') return(dbFindField(pdbentry, precordName));
return (0);
}
int dbFoundField(DBENTRY *pdbentry)
{
return((pdbentry->pfield) ? TRUE : FALSE);
}
long dbFirstRecord(DBENTRY *pdbentry)
{
@@ -2479,34 +2629,42 @@ long dbGetPvlink(DBENTRY *pdbentry,int *pp,int *ms,char *pvname)
}
}
void dbDumpMenu(DBBASE *pdbbase,char *menuName)
void dbDumpPath(DBBASE *pdbbase)
{
dbMenu *pdbMenu;
int gotMatch;
int i;
ELLLIST *ppathList;
dbPathNode *pdbPathNode;
if(!pdbbase) return;
ppathList = (ELLLIST *)pdbbase->pathPvt;
if(!ppathList || !(pdbPathNode = (dbPathNode *)ellFirst(ppathList))) {
printf("no path defined\n");
return;
}
while(pdbPathNode) {
printf("%s",pdbPathNode->directory);
pdbPathNode = (dbPathNode *)ellNext(&pdbPathNode->node);
if(pdbPathNode) printf(":");
}
printf("\n");
return;
}
void dbDumpRecord(dbBase *pdbbase,char *precdesname,int level)
{
if(!pdbbase) {
printf("pdbbase not specified\n");
return;
}
pdbMenu = (dbMenu *)ellFirst(&pdbbase->menuList);
while(pdbMenu) {
if(menuName) {
gotMatch = (strcmp(menuName,pdbMenu->name)==0) ? TRUE : FALSE;
}else {
gotMatch=TRUE;
}
if(gotMatch) {
printf("menu(%s) {\n",pdbMenu->name);
for(i=0; i<pdbMenu->nChoice; i++) {
printf("\tchoice(%s,%s)\n",pdbMenu->papChoiceName[i],
pdbMenu->papChoiceValue[i]);
}
printf("}\n");
if(menuName) break;
}
pdbMenu = (dbMenu *)ellNext(&pdbMenu->node);
dbWriteRecordFP(pdbbase,stdout,precdesname,level);
}
void dbDumpMenu(DBBASE *pdbbase,char *menuName)
{
if(!pdbbase) {
printf("pdbbase not specified\n");
return;
}
dbWriteMenuFP(pdbbase,stdout,menuName);
}
void dbDumpRecDes(DBBASE *pdbbase,char *recdesName)
@@ -2661,25 +2819,11 @@ void dbDumpDevice(DBBASE *pdbbase,char *recdesName)
void dbDumpDriver(DBBASE *pdbbase)
{
drvSup *pdrvSup;
if(!pdbbase) {
printf("pdbbase not specified\n");
return;
}
for(pdrvSup = (drvSup *)ellFirst(&pdbbase->drvList);
pdrvSup; pdrvSup = (drvSup *)ellNext(&pdrvSup->node)) {
printf("%s(%p)\n",pdrvSup->name,pdrvSup->pdrvet);
}
}
void dbDumpRecords(dbBase *pdbbase,char *precdesname,int levl)
{
if(!pdbbase) {
printf("pdbbase not specified\n");
return;
}
dbWriteRecords(pdbbase,stdout,precdesname,levl);
dbWriteDriverFP(pdbbase,stdout);
}
static char *bus[VXI_IO+1] = {"","","VME","CAMAC","AB",

195
src/dbStatic/dbStaticLib.h Normal file
View File

@@ -0,0 +1,195 @@
/* $Id$
*
* Author: Marty Kraimer
* Date: 06-08-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 06-08-93 mrk Replace dbManipulate
* .02 06-07-95 mrk Get rid of default.dctsdr info
*/
#ifndef INCdbStaticLibh
#define INCdbStaticLibh 1
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <limits.h>
#include <ellLib.h>
#include <dbDefs.h>
#include <dbFldTypes.h>
#include <dbBase.h>
#include <link.h>
#include <errMdef.h>
/*Field types as seen by static database access clients*/
#define DCT_STRING 0
#define DCT_INTEGER 1
#define DCT_REAL 2
#define DCT_MENU 3
#define DCT_MENUFORM 4
#define DCT_INLINK 5
#define DCT_OUTLINK 6
#define DCT_FWDLINK 7
#define DCT_NOACCESS 8
/*Link types as seen by static database access clients*/
#define DCT_LINK_CONSTANT 0
#define DCT_LINK_FORM 1
#define DCT_LINK_PV 2
#define DCT_LINK_DEVICE 3
/*options for dbRead and dbWrite*/
#define DB_RECDES_IO 0x1
#define DB_RECORD_IO 0x2
typedef dbBase DBBASE;
typedef struct{
DBBASE *pdbbase;
dbRecDes *precdes;
dbFldDes *pflddes;
dbRecordNode *precnode;
void *pfield;
char *message;
short indfield;
void *formpvt;
} DBENTRY;
/* Static database access routines*/
DBBASE *dbAllocBase(void);
void dbFreeBase(DBBASE *pdbbase);
DBENTRY *dbAllocEntry(DBBASE *pdbbase);
void dbFreeEntry(DBENTRY *pdbentry);
void dbInitEntry(DBBASE *pdbbase,DBENTRY *pdbentry);
void dbFinishEntry(DBENTRY *pdbentry);
DBENTRY *dbCopyEntry(DBENTRY *pdbentry);
long dbReadDatabase(DBBASE **ppdbbase,const char *filename,const char *path);
long dbReadDatabaseFP(DBBASE **ppdbbase,FILE *fp,const char *path);
long dbPath(DBBASE *pdbbase,const char *path);
long dbAddPath(DBBASE *pdbbase,const char *path);
long dbWriteRecord(DBBASE *ppdbbase,const char *filename,
char *precdesname,int level);
long dbWriteRecordFP(DBBASE *ppdbbase,FILE *fp,
char *precdesname,int level);
long dbWriteMenu(DBBASE *pdbbase,const char *filename,char *menuName);
long dbWriteMenuFP(DBBASE *pdbbase,FILE *fp,char *menuName);
long dbWriteRecDes(DBBASE *pdbbase,const char *filename,char *recdesName);
long dbWriteRecDesFP(DBBASE *pdbbase,FILE *fp,char *recdesName);
long dbWriteDevice(DBBASE *pdbbase,const char *filename);
long dbWriteDeviceFP(DBBASE *pdbbase,FILE *fp);
long dbWriteDriver(DBBASE *pdbbase,const char *filename);
long dbWriteDriverFP(DBBASE *pdbbase,FILE *fp);
/*Following two routines are obsolete. For now dbRead calls dbAsciiRead.*/
/* dbWrite does nothing */
long dbRead(DBBASE *pdbbase,FILE *fp);
long dbWrite(DBBASE *pdbbase,FILE *fpdctsdr,FILE *fp);
long dbFindRecdes(DBENTRY *pdbentry,char *recdesname);
long dbFirstRecdes(DBENTRY *pdbentry);
long dbNextRecdes(DBENTRY *pdbentry);
char *dbGetRecdesName(DBENTRY *pdbentry);
int dbGetNRecdes(DBENTRY *pdbentry);
long dbCreateRecord(DBENTRY *pdbentry,char *precordName);
long dbDeleteRecord(DBENTRY *pdbentry);
long dbFindRecord(DBENTRY *pdbentry,char *precordName);
long dbFirstRecord(DBENTRY *pdbentry); /*first of record type*/
long dbNextRecord(DBENTRY *pdbentry);
int dbGetNRecords(DBENTRY *pdbentry);
char *dbGetRecordName(DBENTRY *pdbentry);
long dbRenameRecord(DBENTRY *pdbentry,char *newName);
long dbFindField(DBENTRY *pdbentry,char *pfieldName);
long dbFirstFielddes(DBENTRY *pdbentry,int dctonly);
long dbNextFielddes(DBENTRY *pdbentry,int dctonly);
int dbGetFieldType(DBENTRY *pdbentry);
int dbGetNFields(DBENTRY *pdbentry,int dctonly);
char *dbGetFieldName(DBENTRY *pdbentry);
char *dbGetPrompt(DBENTRY *pdbentry);
int dbGetPromptGroup(DBENTRY *pdbentry);
char *dbGetString(DBENTRY *pdbentry);
long dbPutString(DBENTRY *pdbentry,char *pstring);
char *dbVerify(DBENTRY *pdbentry,char *pstring);
char *dbGetRange(DBENTRY *pdbentry);
int dbIsDefaultValue(DBENTRY *pdbentry);
brkTable *dbFindBrkTable(DBBASE *pdbbase,char *name);
dbMenu *dbFindMenu(DBBASE *pdbbase,char *name);
char **dbGetChoices(DBENTRY *pdbentry);
int dbGetMenuIndex(DBENTRY *pdbentry);
long dbPutMenuIndex(DBENTRY *pdbentry,int index);
int dbGetNMenuChoices(DBENTRY *pdbentry);
int dbAllocForm(DBENTRY *pdbentry);
long dbFreeForm(DBENTRY *pdbentry);
char **dbGetFormPrompt(DBENTRY *pdbentry);
char **dbGetFormValue(DBENTRY *pdbentry);
long dbPutForm(DBENTRY *pdbentry,char **value);
char **dbVerifyForm(DBENTRY *pdbentry,char **value);
int dbGetNLinks(DBENTRY *pdbentry);
long dbGetLinkField(DBENTRY *pdbentry,int index);
int dbGetLinkType(DBENTRY *pdbentry);
long dbCvtLinkToConstant(DBENTRY *pdbentry);
long dbCvtLinkToPvlink(DBENTRY *pdbentry);
long dbPutPvlink(DBENTRY *pdbentry,int pp,int ms,char *pvname);
long dbGetPvlink(DBENTRY *pdbentry,int *pp,int *ms,char *pvname);
/*dump routines*/
void dbDumpPath(DBBASE *pdbbase);
void dbDumpRecord(DBBASE *pdbbase,char *precdesname,int level);
void dbDumpMenu(DBBASE *pdbbase,char *menuName);
void dbDumpRecDes(DBBASE *pdbbase,char *recdesName);
void dbDumpFldDes(DBBASE *pdbbase,char *recdesName,char *fname);
void dbDumpDevice(DBBASE *pdbbase,char *recdesName);
void dbDumpDriver(DBBASE *pdbbase);
void dbPvdDump(DBBASE *pdbbase,int verbose);
void dbReportDeviceConfig(DBBASE *pdbbase,FILE *report);
/* Misc useful routines*/
/*general purpose allocation routines to invoke calloc and maloc */
/* NOTE: These routines do NOT return if they fail. */
void *dbCalloc(size_t nobj,size_t size);
void *dbMalloc(size_t size);
extern int dbDebug;
#define S_dbLib_recdesNotFound (M_dbLib| 1) /*Record Type does not exist*/
#define S_dbLib_recExists (M_dbLib| 3) /*Record Already exists*/
#define S_dbLib_recNotFound (M_dbLib| 5) /*Record Not Found*/
#define S_dbLib_flddesNotFound (M_dbLib| 7) /*Field Description Not Found*/
#define S_dbLib_fieldNotFound (M_dbLib| 9) /*Field Not Found*/
#define S_dbLib_badField (M_dbLib|11) /*Bad Field value*/
#define S_dbLib_menuNotFound (M_dbLib|13) /*Menu not found*/
#define S_dbLib_badLink (M_dbLib|15) /*Bad Link Field*/
#define S_dbLib_nameLength (M_dbLib|17) /*Record Name is too long*/
#define S_dbLib_noRecSup (M_dbLib|19) /*Record support not found*/
#endif /*INCdbStaticLibh*/

View File

@@ -48,13 +48,13 @@ long dbAllocRecord(DBENTRY *pdbentry,char *precordName)
switch(pflddes->field_type) {
case DBF_STRING:
if(pflddes->size <= 0) {
epicsPrintf("size=0 for %s.%s\n",precdes->name,pflddes->name);
fprintf(stderr,"size=0 for %s.%s\n",precdes->name,pflddes->name);
pflddes->size = 1;
}
papField[i] = dbCalloc(pflddes->size,sizeof(char));
if(pflddes->initial) {
if(strlen(pflddes->initial) >= pflddes->size) {
epicsPrintf("initial size > size for %s.%s\n",
fprintf(stderr,"initial size > size for %s.%s\n",
precdes->name,pflddes->name);
} else {
strcpy((char *)papField[i],pflddes->initial);
@@ -97,7 +97,7 @@ long dbAllocRecord(DBENTRY *pdbentry,char *precordName)
case DBF_NOACCESS:
break;
default:
epicsPrintf("dbAllocRecord: Illegal field type\n");
fprintf(stderr,"dbAllocRecord: Illegal field type\n");
}
}
pstr = (char *)papField[0];

View File

@@ -47,6 +47,12 @@ long dbPutStringNum(DBENTRY *pdbentry,char *pstring);
void dbGetRecordtypeSizeOffset(dbRecDes *pdbRecDes);
/* The following is for path */
typedef struct dbPathNode {
ELLNODE node;
char *directory;
} dbPathNode;
/*The following are in dbPvdLib.c*/
/*directory*/
typedef struct{
@@ -54,7 +60,8 @@ typedef struct{
dbRecDes *precdes;
dbRecordNode *precnode;
}PVDENTRY;
int dbPvdTableSize(DBBASE *pdbbase,int size);
int dbPvdTableSize(int size);
extern int dbDebug;
void dbPvdInitPvt(DBBASE *pdbbase);
PVDENTRY *dbPvdFind(DBBASE *pdbbase,char *name,int lenname);
PVDENTRY *dbPvdAdd(DBBASE *pdbbase,dbRecDes *precdes,dbRecordNode *precnode);

View File

@@ -38,7 +38,6 @@ of this distribution.
#include <devSup.h>
#include <drvSup.h>
#include <recSup.h>
#include <cvtTable.h>
#include <special.h>
static char hex_digit_to_ascii[16]={'0','1','2','3','4','5','6','7','8','9',

Some files were not shown because too many files have changed in this diff Show More