Compare commits

...

54 Commits

Author SHA1 Message Date
Janet B. Anderson
afd124a431 Added cvs Id keyword 1995-02-13 21:44:49 +00:00
Janet B. Anderson
a2952bdd75 Update instructions 1995-02-13 20:47:02 +00:00
Marty Kraimer
5003f11977 Resolve diffs between last commits 1995-02-13 20:45:54 +00:00
Janet B. Anderson
8e12035e4a Initial version 1995-02-13 19:39:28 +00:00
Marty Kraimer
294c6778ec For CAMAC allow default (0) for A and F 1995-02-13 19:22:55 +00:00
Janet B. Anderson
3178294f08 fixed on-the-fly so 1st step is to end position 1995-02-13 18:40:11 +00:00
Janet B. Anderson
aa9222e276 Unbundled many files to extensions and removed some unused files. 1995-02-13 17:07:10 +00:00
Janet B. Anderson
fc18b7d4fb Added extern lines. 1995-02-13 16:53:06 +00:00
Janet B. Anderson
d4c7e14fd5 Added VERS and ODLY (output execution delay) 1995-02-13 16:51:34 +00:00
Janet B. Anderson
76dfa54089 Fixed order of posting monitors to be what people
expect (i.e. .cpt, .pxdv, .dxcv)
1995-02-13 16:50:32 +00:00
Janet B. Anderson
24bc06d5ff Reset nRequest to 1 1995-02-13 16:48:55 +00:00
Janet B. Anderson
e19085e380 Removed date from epicsRelease. 1995-02-13 16:46:04 +00:00
Janet B. Anderson
69fc84d4a6 Replaced include genDefs.h with assert.h 1995-02-13 16:42:18 +00:00
Janet B. Anderson
415ac1f797 Remove includes for arAccessLib.h and sydDefs.h 1995-02-13 16:40:26 +00:00
Janet B. Anderson
e4c383cfb5 Added LN and SQRT as synonyms for LOGE and SQR, respectively.
Added NINT, nearest integer function.
Modified handling of "-"  so operator can be either unary or binary.
1995-02-13 16:38:27 +00:00
Janet B. Anderson
c89e742e67 Added NINT 1995-02-13 16:35:52 +00:00
Janet B. Anderson
ab11ca0407 Modified to allow negative values for tsMinWest 1995-02-13 16:32:04 +00:00
Janet B. Anderson
78f3b493ea Unbundled many files to extensions 1995-02-13 16:27:59 +00:00
Janet B. Anderson
cdf7a99013 Unbundled many files to extensions 1995-02-13 16:22:22 +00:00
Janet B. Anderson
47e4ce63b1 Added preserve date option to cp commands 1995-02-13 16:12:32 +00:00
Janet B. Anderson
48cfc5ee15 Added cvs Id keyword 1995-02-13 16:09:14 +00:00
Janet B. Anderson
8746390dda Changed bcopy to memcopy 1995-02-13 16:07:39 +00:00
Janet B. Anderson
cbe1a0b970 Changed bzero to memset. 1995-02-13 16:06:21 +00:00
Janet B. Anderson
273f7aa5e3 Added math library to usr load libs 1995-02-13 16:05:32 +00:00
Janet B. Anderson
e74acbc234 Added math library to load libs 1995-02-13 15:57:30 +00:00
Marty Kraimer
b30c979b0b Set states defined true if any state value OR string is defined 1995-02-13 15:18:04 +00:00
Marty Kraimer
68a0f7a00b Low and High words were mixed up. 1995-02-13 15:15:06 +00:00
Marty Kraimer
0c9de2c129 For ab_bt_write and ab_bt_read, remove from driver list before calling callback 1995-02-13 15:10:55 +00:00
Marty Kraimer
e3f3d9c87b Remove special code for DBR_STRING to allow numeric index (dbLink now does this) 1995-02-13 15:08:18 +00:00
Marty Kraimer
45c5f93950 For DBR_STRING to DBF_choice allow numeric index as well as string choice 1995-02-13 15:05:38 +00:00
Marty Kraimer
c0e1c071bb dbScanLock and dbScanUnlock issue taskSuspend for illegal lock set 1995-02-13 15:04:46 +00:00
Janet B. Anderson
e95156d29b Changed include file from CONFIG_SITE to CONFIG 1995-02-13 15:00:09 +00:00
John Winans
a437b010b3 Killed 162 stuff and ready for TranServ. 1995-02-13 14:53:34 +00:00
Jeff Hill
7d3ed265a5 iocLogClient.c - new log source 1995-02-13 04:03:53 +00:00
Jeff Hill
85e899484d made ca_test.c (more) portable 1995-02-13 03:56:18 +00:00
Jeff Hill
8bb3067b90 drvTS.c - use errMessage () as discussed with jbk
iocInit.c - static => LOCAL for debugging and many changes
		to the parser for resource.def so that we
		allow white space between tokens in env var
1995-02-13 03:54:24 +00:00
Jeff Hill
1b5d92daf1 bucketLib.c - added LOCAL as required
ellLib.c - added missing stdio.h
envSubr.c - use getenv/putenv under vxWorks
errSymLib.c - call mprintf() and not printf or logMsg()
		(eliminated errToLogMsg variable)
genSubr.c - silenced DEC CC warning
tsSubr.c - fixed ts min west out of range test & VMS changes
1995-02-13 03:49:02 +00:00
Jeff Hill
22336dce1b Ignore IOC_BUILD proto form old clients
and make the beacon list global
1995-02-13 03:37:47 +00:00
Jeff Hill
1ecdaff1b5 NT/ALPHA(VMS/printf handler) changes 1995-02-13 03:32:27 +00:00
Marty Kraimer
de878747c6 Added (void *) cast for memset. Changed type for sec to time_t in logTime 1995-02-10 14:05:50 +00:00
Marty Kraimer
3cc8bec710 Changed long to dbr_long_t to get rid of warnings 1995-02-10 13:56:55 +00:00
John Winans
2a87278529 Nuked references to the old 162 code 1995-02-08 19:08:53 +00:00
John Winans
9bbf6fe17e Removed references to the mvme162 stuff (replaced by HiDEOS.) 1995-02-07 18:53:56 +00:00
John Winans
1c4adbf2ce Removed building of the drvMvme162 stuff (replaced by HiDEOS.) 1995-02-07 18:52:25 +00:00
Jim Kowalkowski
0170e0c88a Removed the stinking message "Cannot contact master timing IOC ". 1995-02-02 17:15:55 +00:00
Marty Kraimer
7b1c33aa63 cvtFloatToString and cvtDoubleToString failed for the value 1e7 1995-02-02 16:32:30 +00:00
John Winans
faf07df760 Added a type field to the configure command to disable the use of the event
system hardware if desired.
1995-02-01 15:29:54 +00:00
Janet B. Anderson
9594f7d245 Added X11 include def to USR_INCLUDES 1995-01-23 18:57:00 +00:00
Jim Kowalkowski
61d8593e66 Fix for a problem I believe is about quotes in patternsin dbInitSubs().
Added some debug code.
1995-01-18 20:54:02 +00:00
John Winans
363bf2a47c added the '0x' in front of the hex input and outputs in the report function. 1995-01-18 16:38:03 +00:00
John Winans
ba5d364469 Added a way groovy report function foe use by dbior. 1995-01-18 16:07:29 +00:00
Marty Kraimer
1ea888e720 Cleaned up error messages for missing record, device, driver support 1995-01-17 13:51:37 +00:00
Marty Kraimer
2f4992ceb7 Added ^ and ~ as valid characters (needed for CALC fields) 1995-01-17 13:50:34 +00:00
cvs2svn
3186db5576 This commit was manufactured by cvs2svn to create tag 'R3.12.0-beta6'. 1995-01-09 20:52:03 +00:00
107 changed files with 2875 additions and 1779 deletions

View File

@@ -12,6 +12,9 @@
# install because the release.% syntax is illegal.
#
# $Log$
# Revision 1.22 1994/11/14 23:12:17 tang
# Replace ARCH_TYPE with .
#
# Revision 1.1.1.1 1994/11/09 01:08:53 epics
# Import of R3.12.0Beta
#
@@ -46,7 +49,7 @@
#
EPICS=..
include $(EPICS)/config/CONFIG_SITE
include $(EPICS)/config/CONFIG
all: install

51
README
View File

@@ -16,14 +16,12 @@ set path = ( $path EPICS/base/tools EPICS/base/bin/HOST_ARCH )
set path = ( $path /home/epics/base/tools /home/epics/base/bin/sun4 )
2. If you are using GNU make (which is now THE supported make utility
for the build), you probably want to invoke it with the
--no-print-directory option when you are building at the TOP level:
2. You must use GNU make (which is now THE supported make utility) for
the build. A script, gmake, exists in the base/tools directory to invoke
it with the --no-print-directory option. This option will turn off the
annoying messages GNU make produces upon entering a directory.
make --no-print-directory
This is to turn off the annoying messages GNU make produces upon
entering a directory.
gmake
----------------------------------------------------------------------------
Part 1 - Configuring and Building EPICS Base
@@ -31,13 +29,13 @@ This is to turn off the annoying messages GNU make produces upon
1.1 To configure EPICS, edit the following files:
base/config/CONFIG_SITE - Build choices/HOST_ARCH/Vx location.
base/config/CONFIG_SITE.* - Location of X, etc.
base/config/CONFIG - For overriding specific variables.
config/CONFIG_SITE - Build choices/HOST_ARCH/Vx location.
config/CONFIG_SITE.* - Location of X, etc.
config/CONFIG - For overriding specific variables.
1.2 To add a target architecture to EPICS:
cd epics/base/config
cd epics/config
cp CONFIG_ARCH.mv167 CONFIG_ARCH.YOUR_ARCH
edit CONFIG_ARCH.YOUR_ARCH - For compiler flags / etc.
@@ -50,25 +48,27 @@ This is to turn off the annoying messages GNU make produces upon
1.3 To build EPICS:
make - To build and install EPICS.
make clean - To clean temporary object files. Clean will
remove files from ALL O.ARCH dirs, not
only those specified in BUILD_ARCHS.
cd epics/base
gmake - To build and install EPICS.
gmake clean - To clean temporary object files. Clean will
remove files from ALL O.ARCH dirs, not
only those specified in BUILD_ARCHS.
1.4 To create an EPICS release:
edit include/version.h - ONLY IF you need to change the EPICS
edit base/include/version.h - ONLY IF you need to change the EPICS
version number.
make release - Will create Tar file, but only after
generating dependencies.
make built_release - Same as above, but INCLUDING BINARIES.
gmake release - Will create Tar file
gmake built_release - Will create Tar file, after generating
dependencies, INCLUDING BINARIES.
1.5 "Partial" build commands:
make clean.sun4 - Cleans sun4 binaries in O.sun4 dirs only.
make install.sun4 - Builds sun4 only.
make install.mv167 - Builds mv167 only (a HOST_ARCH build must
gmake clean.sun4 - Cleans sun4 binaries in O.sun4 dirs only.
gmake install.sun4 - Builds sun4 only.
gmake install.mv167 - Builds mv167 only (a HOST_ARCH build must
be complete before this can be issued).
NOTES:
@@ -81,8 +81,8 @@ NOTES:
3. During a normal build (a "make" or "make install"), the "depends"
dependency will NOT be invoked. Only if "make depends" is run
explicitly, or a "make release" is performed will dependencies be
generated automatically.
explicitly, or a "make built_release" is performed will dependencies
be generated automatically.
4. Temporary objects are stored in src/DIR/O.ARCH, This allows objects
for multiple architectures to be maintained at the same time.
@@ -229,9 +229,6 @@ RULES.Unix - - - -
Dependencies supported by lower level Makefiles:
depends - Generate include dependencies
pre_build - Build e_flex / antelope
build_libs - Builds libraries for use in "build"
install_libs - Installs these libraries in lib/ARCH
build - Builds objects, using libraries from "build_libs"
install - Installs executables in bin/ARCH
clean - Cleans objects

View File

@@ -3,7 +3,7 @@ include Target.include
include $(EPICS)/config/CONFIG_BASE
USR_CFLAGS = -D_NO_PROTO
USR_LDLIBS = -lAs -lCom -lDb -lCom -s
USR_LDLIBS = -lAs -lCom -lDb -lCom -lm -s
USR_LDFLAGS = -L.
DEPLIBS_BASE = $(EPICS_BASE_LIB)

View File

@@ -15,7 +15,7 @@ $! - You are using Multinet for TCP/IP access. If not, the logical
$! name definitions below will need to be changed
$!
$!
$! Arguments : None
$! Arguments : optional source file name
$!
$! Created 16-NOV-1993 Mark L. Rivers
$! 05-MAY-1994 Jeff O. Hill Updated for EPICS 3.12
@@ -30,11 +30,13 @@ $ define /nolog arpa multinet_root:[multinet.include.arpa]
$ define /nolog tcp multinet_root:[multinet.include]
$!
$! Compile the functions and test programs
$! Define symbol for the CC command
$ call set_cc_command
$ if (p1 .nes. "")
$ then
$ cc /defines=(__STDC__)/include=([]) 'p1'
$ cc_command 'p1'
$ else
$ cc /defines=(__STDC__)/include=([]) -
$ cc_command -
ACCESS, -
CONN, -
CONVERT, -
@@ -50,7 +52,10 @@ IF_DEPEN, -
VMS_DEPEN, -
ELLLIB, -
BUCKETLIB, -
NEXTFIELDSUBR, -
ENVSUBR, -
TSSUBR, -
GENSUBR, -
CATIME, -
ACCTST
$ endif
@@ -71,7 +76,10 @@ IF_DEPEN, -
VMS_DEPEN, -
BSD_DEPEN, -
BUCKETLIB, -
NEXTFIELDSUBR, -
TSSUBR, -
ENVSUBR, -
GENSUBR, -
ELLLIB
$! Link the test programs
$ call link acctst
@@ -84,10 +92,32 @@ $ catime == "$ EPICS_EXE:catime.exe"
$
$!
$ link: subroutine
$ link 'p1', sys$input/options
channel_access/lib
multinet_socket_library/share
sys$share:vaxcrtl/share
$! Link differently for VAX and AXP
$ if f$getsyi("HW_MODEL") .ge. 1024
$ then
$ link 'p1', sys$input/options
channel_access/lib
multinet_socket_library/share
$ else
$ link 'p1', sys$input/options
channel_access/lib
multinet_socket_library/share
sys$share:vaxcrtl/share
$ endif
$ endsubroutine
$
$
$! This subroutine sets up "cc_command" to use different switches for
$! VAX (assumes VAX C compiler) and AXP (DEC C compiler).
$ set_cc_command : subroutine
$ if f$getsyi("HW_MODEL") .ge. 1024
$ then
$! turn of no prototype messages because MULTINET does not
$! supply prototypes.
$ cc_command:== cc /warn=(disable=IMPLICITFUNC)/float=d_float /include=([], [-.include], [-.libcom])
$ else
$ cc_command:== cc /include=([], [-.include], [-.libcom])
$ endif
$ endsubroutine
$! ************************************************************

View File

@@ -3,18 +3,19 @@ include Target.include
include $(EPICS)/config/CONFIG_BASE
USR_CFLAGS = -DACCESS_SECURITY -D_NO_PROTO
USR_LDLIBS = -lca -lCom
USR_LDLIBS = -lca -lCom -lm
USR_LDFLAGS = -L.
DEPLIBS_BASE = $(EPICS_BASE_LIB)
DEPLIBS = ./libca.a\
$(DEPLIBS_BASE)/libCom.a
SRCS.c = \
../iocinf.c ../access.c ../test_event.c ../service.c \
../flow_control.c ../repeater.c ../conn.c ../acctst.c \
../flow_control.c ../repeater.c ../conn.c \
../syncgrp.c ../if_depen.c ../netdb_depen.c ../bsd_depen.c \
../posix_depen.c ../caRepeater.c ../acctst.c
../posix_depen.c ../caRepeater.c ../acctst.c ../catime.c
OBJS = caRepeater.o
@@ -35,3 +36,9 @@ acctst: acctst.o $(DEPLIBS_BASE)/libCom.a libca.a
acctst.o: ../acctst.c
$(COMPILE.c) $<
catime: catime.o $(DEPLIBS_BASE)/libCom.a libca.a
catime.o: ../catime.c
$(COMPILE.c) $<

View File

@@ -134,6 +134,7 @@ static char *sccsId = "@(#) $Id$";
#include "iocinf.h"
#include "net_convert.h"
#include <stdarg.h> /* for VMS old CC include order madness */
/****************************************************************/
@@ -142,19 +143,6 @@ static char *sccsId = "@(#) $Id$";
#define EXTMSGPTR(PIIU)\
((struct extmsg *) &(PIIU)->send.buf[(PIIU)->send.wtix])
/*
* Performs worst case message alignment
*/
#define CAC_ADD_MSG(PIIU) \
{ \
unsigned long size; \
struct extmsg *mp = EXTMSGPTR(PIIU); \
size = mp->m_postsize = CA_MESSAGE_ALIGN(mp->m_postsize); \
mp->m_postsize = htons(mp->m_postsize); \
CAC_RING_BUFFER_WRITE_ADVANCE( \
&(PIIU)->send, sizeof(struct extmsg) + size); \
}
@@ -189,12 +177,14 @@ static struct extmsg nullmsg;
/*
* local functions
*/
#if 0
LOCAL int cac_alloc_msg(
struct ioc_in_use *piiu,
unsigned extsize,
struct extmsg **ppMsg
);
#endif
LOCAL int cac_alloc_msg_no_flush(
struct ioc_in_use *piiu,
unsigned extsize,
@@ -230,6 +220,8 @@ struct extmsg *pmsg,
void *pext
);
LOCAL void cac_add_msg (IIU *piiu);
#ifdef CONVERSION_REQUIRED
LOCAL void *malloc_put_convert(unsigned long size);
LOCAL void free_put_convert(void *pBuf);
@@ -253,15 +245,15 @@ void *pext
)
{
struct extmsg msg;
unsigned long bytesAvailable;
unsigned long actualextsize;
unsigned long extsize;
unsigned long bytesSent;
unsigned bytesAvailable;
unsigned actualextsize;
unsigned extsize;
unsigned bytesSent;
msg = *pmsg;
actualextsize = pmsg->m_postsize;
extsize = CA_MESSAGE_ALIGN(pmsg->m_postsize);
msg.m_postsize = htons(extsize);
msg.m_postsize = htons((ca_uint16_t)extsize);
LOCK;
@@ -347,8 +339,8 @@ void *pext
* if present
*/
{
static nullBuff[32];
int n;
static nullBuff[32];
unsigned n;
n = extsize-actualextsize;
if(n){
@@ -421,6 +413,7 @@ struct extmsg **ppMsg
* LOCK should be on
*
*/
#if 0
LOCAL int cac_alloc_msg(
struct ioc_in_use *piiu,
unsigned extsize,
@@ -480,13 +473,33 @@ struct extmsg **ppMsg
return ECA_NORMAL;
}
#endif
/*
* cac_add_msg ()
*/
LOCAL void cac_add_msg (IIU *piiu)
{
unsigned long size;
struct extmsg *mp = EXTMSGPTR(piiu);
/*
* Performs worst case message alignment
*/
mp->m_postsize = (unsigned short)
CA_MESSAGE_ALIGN(mp->m_postsize);
size = mp->m_postsize;
mp->m_postsize = htons(mp->m_postsize);
CAC_RING_BUFFER_WRITE_ADVANCE(
&piiu->send,
sizeof(struct extmsg) + size);
}
/*
*
* CA_TASK_INITIALIZE
*
*
*/
int APIENTRY ca_task_initialize(void)
{
@@ -518,6 +531,8 @@ int ca_os_independent_init (void)
ca_static->ca_exception_func = ca_default_exception_handler;
ca_static->ca_exception_arg = NULL;
caSetDefaultPrintfHandler();
/* record a default user name */
ca_static->ca_pUserName = localUserName();
if(!ca_static->ca_pUserName){
@@ -541,10 +556,10 @@ int ca_os_independent_init (void)
*/
ca_static->ca_search_retry = 0;
ca_static->ca_conn_next_retry = CA_CURRENT_TIME;
sec = CA_RECAST_DELAY;
sec = (unsigned) CA_RECAST_DELAY;
ca_static->ca_conn_retry_delay.tv_sec = sec;
ca_static->ca_conn_retry_delay.tv_usec =
(CA_RECAST_DELAY-sec)*USEC_PER_SEC;
(long) (CA_RECAST_DELAY-sec)*USEC_PER_SEC;
ellInit(&ca_static->ca_iiuList);
ellInit(&ca_static->ca_ioeventlist);
@@ -597,8 +612,6 @@ int ca_os_independent_init (void)
*/
LOCAL void create_udp_fd()
{
int pri;
char name[64];
int status;
if(ca_static->ca_piiuCast){
@@ -615,38 +628,43 @@ LOCAL void create_udp_fd()
}
#ifdef vxWorks
status = taskPriorityGet(VXTASKIDSELF, &pri);
if(status<0)
ca_signal(ECA_INTERNAL,NULL);
{
int pri;
char name[64];
strcpy(name,"RD ");
strncat(
name,
taskName(VXTHISTASKID),
sizeof(name)-strlen(name)-1);
status = taskPriorityGet(VXTASKIDSELF, &pri);
if(status<0)
ca_signal(ECA_INTERNAL,NULL);
strcpy(name,"RD ");
strncat(
name,
taskName(VXTHISTASKID),
sizeof(name)-strlen(name)-1);
status = taskSpawn(
name,
pri-1,
VX_FP_TASK,
4096,
(FUNCPTR)cac_recv_task,
(int)taskIdCurrent,
0,
0,
0,
0,
0,
0,
0,
0,
0);
if (status<0) {
ca_signal(ECA_INTERNAL,NULL);
}
ca_static->recv_tid = status;
status = taskSpawn(
name,
pri-1,
VX_FP_TASK,
4096,
(FUNCPTR)cac_recv_task,
(int)taskIdCurrent,
0,
0,
0,
0,
0,
0,
0,
0,
0);
if (status<0) {
ca_signal(ECA_INTERNAL,NULL);
}
ca_static->recv_tid = status;
#endif
}
@@ -1072,7 +1090,7 @@ int APIENTRY ca_search_and_connect
chix->pConnFunc = conn_func;
chix->type = TYPENOTCONN; /* invalid initial type */
chix->count = 0; /* invalid initial count */
chix->id.sid = ~0L; /* invalid initial server id */
chix->id.sid = ~0U; /* invalid initial server id */
chix->state = cs_never_conn;
ellInit(&chix->eventq);
@@ -1088,10 +1106,10 @@ int APIENTRY ca_search_and_connect
*/
ca_static->ca_search_retry = 0;
ca_static->ca_conn_next_retry = CA_CURRENT_TIME;
sec = CA_RECAST_DELAY;
sec = (int) CA_RECAST_DELAY;
ca_static->ca_conn_retry_delay.tv_sec = sec;
ca_static->ca_conn_retry_delay.tv_usec =
(CA_RECAST_DELAY-sec)*USEC_PER_SEC;
(long) (CA_RECAST_DELAY-sec)*USEC_PER_SEC;
UNLOCK;
@@ -1152,7 +1170,7 @@ int reply_type
mptr++;
strncpy((char *)mptr, (char *)(chix + 1), size);
CAC_ADD_MSG(piiu);
cac_add_msg(piiu);
/*
* increment the number of times we have tried this
@@ -1721,7 +1739,7 @@ void *pvalue
struct extmsg hdr;
int postcnt;
unsigned size_of_one;
int i;
unsigned i;
# ifdef CONVERSION_REQUIRED
void *pCvrtBuf;
void *pdest;
@@ -1777,6 +1795,8 @@ void *pvalue
case DBR_ENUM:
case DBR_SHORT:
case DBR_PUT_ACKT:
case DBR_PUT_ACKS:
# if DBR_INT != DBR_SHORT
case DBR_INT:
# endif /*DBR_INT != DBR_SHORT*/
@@ -1812,10 +1832,10 @@ void *pvalue
hdr.m_cmmd = htons(cmd);
hdr.m_type = htons(type);
hdr.m_count = htons(count);
hdr.m_count = htons((ca_uint16_t)count);
hdr.m_cid = chix->id.sid;
hdr.m_available = id;
hdr.m_postsize = postcnt;
hdr.m_postsize = (ca_uint16_t) postcnt;
status = cac_push_msg(piiu, &hdr, pvalue);
@@ -2033,7 +2053,6 @@ long mask
{
evid monix;
int status;
int size;
INITCHK;
LOOSECHIXCHK(chix);
@@ -2063,7 +2082,8 @@ long mask
if (!chix->piiu) {
# ifdef vxWorks
static int dbevsize;
int size;
static int dbevsize;
if(!dbevsize){
dbevsize = db_sizeof_event_block();
@@ -2098,7 +2118,7 @@ long mask
monix->p_delta = p_delta;
monix->n_delta = n_delta;
monix->timeout = timeout;
monix->mask = mask;
monix->mask = (unsigned short) mask;
# ifdef vxWorks
if(!chix->piiu){
@@ -2169,8 +2189,10 @@ int ca_request_event(evid monix)
unsigned count;
struct monops msg;
struct ioc_in_use *piiu;
ca_float32_t p_delta;
ca_float32_t n_delta;
ca_float32_t tmo;
piiu = chix->piiu;
/*
@@ -2201,9 +2223,12 @@ int ca_request_event(evid monix)
msg.m_header.m_postsize = sizeof(msg.m_info);
/* msg body */
htonf(&monix->p_delta, &msg.m_info.m_hval);
htonf(&monix->n_delta, &msg.m_info.m_lval);
htonf(&monix->timeout, &msg.m_info.m_toval);
p_delta = (ca_float32_t) monix->p_delta;
n_delta = (ca_float32_t) monix->n_delta;
tmo = (ca_float32_t) monix->timeout;
htonf(&p_delta, &msg.m_info.m_hval);
htonf(&n_delta, &msg.m_info.m_lval);
htonf(&tmo, &msg.m_info.m_toval);
msg.m_info.m_mask = htons(monix->mask);
status = cac_push_msg(piiu, &msg.m_header, &msg.m_info);
@@ -2563,9 +2588,9 @@ int APIENTRY ca_clear_channel (chid chix)
/* msg header */
hdr.m_cmmd = htons(IOC_CLEAR_CHANNEL);
hdr.m_available = chix->cid;
hdr.m_cid = chix->id.sid;
hdr.m_type = htons(0);
hdr.m_count = htons(0);
hdr.m_cid = chix->id.sid;
hdr.m_postsize = 0;
status = cac_push_msg(piiu, &hdr, NULL);
@@ -2697,11 +2722,11 @@ int APIENTRY ca_pend(ca_real timeout, int early)
/*
* Allow for CA background labor
*/
remaining = min(SELECT_POLL, remaining);
remaining = (long) min(SELECT_POLL, remaining);
}
tmo.tv_sec = remaining;
tmo.tv_usec = (remaining-tmo.tv_sec)*USEC_PER_SEC;
tmo.tv_sec = (long) remaining;
tmo.tv_usec = (long) (remaining-tmo.tv_sec)*USEC_PER_SEC;
cac_block_for_io_completion(&tmo);
}
}
@@ -3015,7 +3040,7 @@ int echo_request(struct ioc_in_use *piiu, ca_time *pCurrentTime)
phdr->m_available = htons(0);
phdr->m_postsize = 0;
CAC_ADD_MSG(piiu);
cac_add_msg(piiu);
piiu->echoPending = TRUE;
piiu->send_needed = TRUE;
@@ -3214,7 +3239,7 @@ LOCAL void ca_default_exception_handler(struct exception_handler_args args)
*/
LOCK;
sprintf(sprintf_buf,
"%s - with request chan=%s op=%d data type=%s count=%d\n",
"%s - with request chan=%s op=%d data type=%s count=%d",
args.ctx,
pName,
args.op,
@@ -3265,7 +3290,7 @@ int ca_defunct()
* currently implemented as a function
* (may be implemented as a MACRO in the future)
*/
char APIENTRY *ca_host_name_function(chid chix)
char * APIENTRY ca_host_name_function(chid chix)
{
IIU *piiu;
@@ -3353,3 +3378,69 @@ int ca_channel_status(int tid)
return ECA_NORMAL;
}
#endif /*vxWorks*/
/*
* ca_replace_printf_handler ()
*/
int APIENTRY ca_replace_printf_handler (
int (*ca_printf_func)(char *pformat, va_list args)
)
{
if (ca_printf_func) {
ca_static->ca_printf_func = ca_printf_func;
}
else {
/*
* os dependent
*/
caSetDefaultPrintfHandler();
}
return ECA_NORMAL;
}
/*
* ca_printf()
*/
int ca_printf(char *pformat, ...)
{
int (*ca_printf_func)(char *pformat, va_list args);
va_list theArgs;
int status;
va_start(theArgs, pformat);
ca_printf_func = ca_default_printf;
if (ca_static) {
if (ca_static->ca_printf_func) {
ca_printf_func = ca_static->ca_printf_func;
}
}
status = (*ca_printf_func) (pformat, theArgs);
va_end(theArgs);
return status;
}
/*
* ca_default_printf()
* (this default is replaced under vxWorks
* - see vxWorks_depen.c)
*/
int ca_default_printf(char *pformat, va_list args)
{
int status;
status = vfprintf(
stderr,
pformat,
args);
return status;
}

View File

@@ -10,6 +10,7 @@ static char *sccsId = "@(#) $Id$";
#endif
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "os_depen.h"

View File

@@ -18,8 +18,8 @@ void caAddConfiguredAddr(
SOCKET socket,
int port);
int local_addr(SOCKET socket, struct sockaddr_in *plcladdr);
int local_addr(SOCKET socket, struct sockaddr_in *plcladdr);
int caFetchPortConfig(ENV_PARAM *pEnv, int defaultPort);
union caAddr{
struct sockaddr_in inetAddr;

View File

@@ -45,10 +45,9 @@ int cac_select_io(struct timeval *ptimeout, int flags)
long status;
IIU *piiu;
unsigned long freespace;
int maxfd;
SOCKET maxfd;
caFDInfo *pfdi;
LOCK;
pfdi = (caFDInfo *) ellGet(&ca_static->fdInfoFreeList);

View File

@@ -52,12 +52,7 @@ static char *sccsId = "@(#) $Id$";
* Dump error messages to the appropriate place
*
*/
#ifdef __STDC__
int ca_printf(char *pformat, ...)
#else
int ca_printf(va_alist)
va_dcl
#endif
{
va_list args;
int status;
@@ -65,29 +60,9 @@ va_dcl
va_start(args, pformat);
#if defined(vxWorks)
{
int logMsgArgs[6];
int i;
for(i=0; i< NELEMENTS(logMsgArgs); i++){
logMsgArgs[i] = va_arg(args, int);
}
status = logMsg(
pformat,
logMsgArgs[0],
logMsgArgs[1],
logMsgArgs[2],
logMsgArgs[3],
logMsgArgs[4],
logMsgArgs[5]);
}
status = mprintf(pformat, args);
#else
status = vfprintf(
stderr,
pformat,
args);
status = vfprintf(stderr, pformat, args);
#endif
va_end(args);

View File

@@ -1,29 +1,24 @@
/*
*
* CA performance test
*
* History
* joh 09-12-89 Initial release
* joh 12-20-94 portability
*
*
*/
CA performance test
History
joh 09-12-89 Initial release
*/
#ifdef VMS
#include <LIB$ROUTINES.H>
#endif
/* System includes */
#ifdef vxWorks
#include <vxWorks.h>
#include <taskLib.h>
#endif
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include <cadef.h>
#include <caerr.h>
#include <db_access.h>
#ifndef LOCAL
#define LOCAL static
#endif
#ifndef OK
#define OK 0
@@ -41,17 +36,44 @@
#define NELEMENTS(A) (sizeof (A) / sizeof ((A) [0]))
#endif
#define NUM 1
#define ITERATION_COUNT 10000
#define WAIT_FOR_ACK
chid chan_list[min(10000,ITERATION_COUNT)];
typedef struct testItem {
chid chix;
char name[40];
int type;
int count;
union db_access_val val;
}ti;
ti itemList[ITERATION_COUNT];
int catime(char *channelName);
typedef void tf (ti *pItems, unsigned iterations);
LOCAL void test (
ti *pItems,
unsigned iterations
);
LOCAL tf test_search;
LOCAL tf test_free;
LOCAL tf test_wait;
LOCAL tf test_put;
LOCAL tf test_wait;
LOCAL tf test_get;
void timeIt(
tf *pfunc,
ti *pItem,
unsigned iterations
);
#ifndef vxWorks
main(argc, argv)
int argc;
char **argv;
int main(int argc, char **argv)
{
char *pname;
@@ -61,167 +83,251 @@ char **argv;
}
else{
printf("usage: %s <channel name>", argv[0]);
return -1;
}
return 0;
}
#endif
catime(channelName)
char *channelName;
/*
* catime ()
*/
int catime (char *channelName)
{
chid ai_1;
long status;
long i,j;
unsigned strsize;
long status;
long i,j;
void *ptr;
int test_search(), test_free();
SEVCHK (ca_task_initialize(),"Unable to initialize");
SEVCHK(ca_task_initialize(),"Unable to initialize");
strsize = sizeof(itemList[i].name)-1;
for (i=0; i<NELEMENTS(itemList); i++) {
strncpy (
itemList[i].name,
channelName,
strsize);
itemList[i].name[strsize]= '\0';
itemList[i].count = 1;
}
printf ("search test\n");
timeIt (test_search, itemList, NELEMENTS(itemList));
SEVCHK(ca_search(channelName,&ai_1),NULL);
status = ca_pend_io(5.0);
SEVCHK(status,NULL);
if(status == ECA_TIMEOUT)
exit(OK);
printf (
"channel name=%s, native type=%d, native count=%d\n",
ca_name(itemList[0].chix),
ca_field_type(itemList[0].chix),
ca_element_count(itemList[0].chix));
ptr = (void *) malloc(NUM*sizeof(union db_access_val)+NUM*MAX_STRING_SIZE);
if(!ptr)
exit(OK);
for (i=0; i<NELEMENTS(itemList); i++) {
itemList[i].val.fltval = 0.0;
itemList[i].type = DBR_FLOAT;
}
printf ("float test\n");
test (itemList, NELEMENTS(itemList));
printf("channel name %s native type %d native count %d\n",ai_1+1,ai_1->type,ai_1->count);
printf("search test\n");
timex(test_search,channelName);
printf("free test\n");
timex(test_free,ai_1);
for (i=0; i<NELEMENTS(itemList); i++) {
strcpy(itemList[i].val.strval, "0.0");
itemList[i].type = DBR_STRING;
}
printf ("string test\n");
test (itemList, NELEMENTS(itemList));
for (i=0; i<NELEMENTS(itemList); i++) {
itemList[i].val.intval = 0;
itemList[i].type = DBR_INT;
}
printf ("interger test\n");
test (itemList, NELEMENTS(itemList));
for(i=0;i<NUM;i++)
((float *)ptr)[i] = 0.0;
test(ai_1, "DBR_FLOAT", DBR_FLOAT, NUM, ptr);
printf ("free test\n");
timeIt (test_free, itemList, NELEMENTS(itemList));
for(i=0;i<NUM;i++)
strcpy((char *)ptr+(MAX_STRING_SIZE*i),"0.0");
test(ai_1, "DBR_STRING", DBR_STRING, NUM, ptr);
for(i=0;i<NUM;i++)
((int *)ptr)[i]=0;
test(ai_1, "DBR_INT", DBR_INT, NUM, ptr);
free(ptr);
exit(OK);
return OK;
}
test(chix, name, type, count, ptr)
chid chix;
char *name;
int type,count;
void *ptr;
/*
* test ()
*/
LOCAL void test (
ti *pItems,
unsigned iterations
)
{
int test_put(), test_get(), test_wait();
printf("%s\n",name);
timex(test_put,chix, name, type, count, ptr);
timex(test_get,chix, name, type, count, ptr);
timex(test_wait,chix, name, type, count, ptr);
printf ("\tasync put test\n");
timeIt(test_put, pItems, iterations);
printf ("\tasync get test\n");
timeIt(test_get, pItems, iterations);
printf ("\tsynch get test\n");
timeIt(test_wait, pItems, iterations);
}
#ifndef vxWorks
timex(pfunc, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
void (*pfunc)();
int arg1;
int arg2;
int arg3;
int arg4;
int arg5;
int arg6;
int arg7;
/*
* timeIt ()
*/
void timeIt(
tf *pfunc,
ti *pItems,
unsigned iterations
)
{
(*pfunc)(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
TS_STAMP end_time;
TS_STAMP start_time;
double delay;
int status;
}
#endif
test_search(name)
char *name;
{
int i;
for(i=0; i< NELEMENTS(chan_list);i++){
SEVCHK(ca_search(name,&chan_list[i]),NULL);
}
SEVCHK(ca_pend_io(0.0),NULL);
status = tsLocalTime(&start_time);
assert (status == S_ts_OK);
(*pfunc) (pItems, iterations);
status = tsLocalTime(&end_time);
assert (status == S_ts_OK);
TsDiffAsDouble(&delay,&end_time,&start_time);
printf ("Elapsed Per Item = %f\n", delay/iterations);
}
test_free(chix)
chid chix;
/*
* test_search ()
*/
LOCAL void test_search(
ti *pItems,
unsigned iterations
)
{
int i;
union db_access_val ival;
int i;
int status;
chid chan;
for(i=0; i< NELEMENTS(chan_list);i++){
SEVCHK(ca_clear_channel(chan_list[i]),NULL);
}
status = ca_search (
pItems[0].name,
&chan);
SEVCHK (status, NULL);
status = ca_pend_io(0.0);
for (i=0; i< iterations;i++) {
pItems[i].chix = chan;
}
SEVCHK (status, NULL);
}
/*
* test_free ()
*/
LOCAL void test_free(
ti *pItems,
unsigned iterations
)
{
int i;
int status;
dbr_int_t val;
status = ca_clear_channel (pItems[0].chix);
SEVCHK (status, NULL);
#if 0
#ifdef WAIT_FOR_ACK
SEVCHK(ca_array_get(DBR_INT,1,chix,&ival),NULL);
SEVCHK(ca_pend_io(0.0),NULL);
#else
SEVCHK(ca_flush_io(),NULL);
status = ca_array_get (DBR_INT, 1, pItems[0].chix, &val);
SEVCHK (status, NULL);
status = ca_pend_io(100.0);
SEVCHK (status, NULL);
#endif
status = ca_clear_channel (pItems[0].chix);
SEVCHK (status, NULL);
status = ca_flush_io();
SEVCHK (status, NULL);
#endif
}
test_put(chix, name, type, count, ptr)
chid chix;
char *name;
int type,count;
void *ptr;
/*
* test_put ()
*/
LOCAL void test_put(
ti *pItems,
unsigned iterations
)
{
int i;
int i;
int status;
dbr_int_t val;
for(i=0; i< ITERATION_COUNT;i++){
SEVCHK(ca_array_put(type,count,chix,ptr),NULL);
#if 0
ca_flush_io();
#endif
}
for (i=1; i<iterations; i++) {
status = ca_array_put(
pItems[i].type,
pItems[i].count,
pItems[i].chix,
&pItems[i].val);
SEVCHK (status, NULL);
}
#ifdef WAIT_FOR_ACK
SEVCHK(ca_array_get(type,count,chix,ptr),NULL);
SEVCHK(ca_pend_io(0.0),NULL);
#else
SEVCHK(ca_flush_io(),NULL);
status = ca_array_get (DBR_INT, 1, pItems[0].chix, &val);
SEVCHK (status, NULL);
status = ca_pend_io(100.0);
#endif
status = ca_array_put(
pItems[0].type,
pItems[0].count,
pItems[0].chix,
&pItems[0].val);
SEVCHK (status, NULL);
status = ca_flush_io();
SEVCHK (status, NULL);
}
test_get(chix, name, type, count, ptr)
chid chix;
char *name;
int type,count;
void *ptr;
/*
* test_get ()
*/
LOCAL void test_get(
ti *pItems,
unsigned iterations
)
{
int i;
for(i=0; i< ITERATION_COUNT;i++){
SEVCHK(ca_array_get(type,count,chix,ptr),NULL);
#if 0
ca_flush_io();
#endif
}
SEVCHK(ca_pend_io(0.0),NULL);
int i;
int status;
for (i=0; i<iterations; i++) {
status = ca_array_get(
pItems[i].type,
pItems[i].count,
pItems[i].chix,
&pItems[i].val);
SEVCHK (status, NULL);
}
status = ca_pend_io(100.0);
SEVCHK (status, NULL);
}
test_wait(chix, name, type, count, ptr)
chid chix;
char *name;
int type,count;
void *ptr;
/*
* test_wait ()
*/
LOCAL void test_wait (
ti *pItems,
unsigned iterations
)
{
int i;
for(i=0; i< ITERATION_COUNT;i++){
SEVCHK(ca_array_get(type,count,chix,ptr),NULL);
SEVCHK(ca_pend_io(0.0),NULL);
}
int i;
int status;
for (i=1; i<iterations; i++) {
status = ca_array_get(
pItems[i].type,
pItems[i].count,
pItems[i].chix,
&pItems[i].val);
SEVCHK (status, NULL);
status = ca_pend_io(100.0);
SEVCHK (status, NULL);
}
}

View File

@@ -68,7 +68,7 @@ void manage_conn(int silent)
IIU *piiu;
ca_time current;
ca_real delay;
unsigned long idelay;
long idelay;
/*
* prevent recursion
@@ -214,10 +214,10 @@ void manage_conn(int silent)
idelay = idelay << ca_static->ca_search_retry;
delay = idelay * CA_RECAST_DELAY; /* sec */
delay = min (CA_RECAST_PERIOD, delay);
idelay = delay;
idelay = (long) delay;
ca_static->ca_conn_retry_delay.tv_sec = idelay;
ca_static->ca_conn_retry_delay.tv_usec =
(delay-idelay)*USEC_PER_SEC;
(long) ((delay-idelay)*USEC_PER_SEC);
ca_static->ca_conn_next_retry =
cac_time_sum (
&current,
@@ -347,12 +347,7 @@ LOCAL void logRetryInterval(char *pFN, unsigned lineno)
/*
*
*
* MARK_SERVER_AVAILABLE
*
*
*
*/
void mark_server_available(struct in_addr *pnet_addr)
{
@@ -465,16 +460,16 @@ void mark_server_available(struct in_addr *pnet_addr)
{
ca_real diff;
ca_real delay;
unsigned idelay;
long idelay;
ca_time ca_delay;
ca_time next;
delay = (port&CA_RECAST_PORT_MASK);
delay /= MSEC_PER_SEC;
delay += CA_RECAST_DELAY;
idelay = delay;
idelay = (long) delay;
ca_delay.tv_sec = idelay;
ca_delay.tv_usec = (delay-idelay) * USEC_PER_SEC;
ca_delay.tv_usec = (long) (delay-idelay) * USEC_PER_SEC;
next = cac_time_sum(&currentTime, &ca_delay);
diff = cac_time_diff(
@@ -484,10 +479,10 @@ void mark_server_available(struct in_addr *pnet_addr)
ca_static->ca_conn_next_retry = next;
LOGRETRYINTERVAL
}
idelay = CA_RECAST_DELAY;
idelay = (long) CA_RECAST_DELAY;
ca_static->ca_conn_retry_delay.tv_sec = idelay;
ca_static->ca_conn_retry_delay.tv_usec =
(CA_RECAST_DELAY-idelay) * USEC_PER_SEC;
(long) ((CA_RECAST_DELAY-idelay) * USEC_PER_SEC);
ca_static->ca_search_retry = 0;
}

View File

@@ -35,11 +35,6 @@ static char *sccsId = "@(#) $Id$";
#include "iocinf.h"
#include "net_convert.h"
void htond(double *pHost, double *pNet);
void ntohd(double *pNet, double *pHost);
void htonf(float *pHost, float *pNet);
void ntohf(float *pNet, float *pHost);
/*
* if hton is true then it is a host to network conversion
* otherwise vise-versa
@@ -1374,7 +1369,7 @@ unsigned long num /* number of values */
}
#ifdef CA_FLOAT_MIT
#if defined(CA_FLOAT_MIT)
/************************************************************************/
/* double convert */
/* (THIS ASSUMES IEEE IS THE NETWORK FLOATING POINT FORMAT) */
@@ -1383,7 +1378,7 @@ unsigned long num /* number of values */
/* (this includes mapping of fringe reals to zero or infinity) */
/* (byte swaps included in conversion */
struct ieeedbl{
struct ieeedbl {
unsigned int mant2 : 32;
unsigned int mant1 : 20;
unsigned int exp : 11;
@@ -1396,7 +1391,7 @@ struct ieeedbl{
/* -1022<exp<1024 with mantissa of form 1.mant */
#define DBLEXPMINIEEE -1022 /* min for norm # IEEE exponent */
struct mitdbl{
struct mitdbl {
unsigned int mant1 : 7;
unsigned int exp : 8;
unsigned int sign : 1;
@@ -1413,7 +1408,6 @@ struct mitdbl{
#define DBLEXPMAXMIT 126 /* max MIT exponent */
#define DBLEXPMINMIT -128 /* min MIT exponent */
void htond(double *pHost, double *pNet)
{
double copyin;
@@ -1538,19 +1532,19 @@ struct mitflt{
void htonf(float *pHost, float *pNet)
{
struct mitflt *pMIT = pHost;
struct ieeeflt *pIEEE = pNet;
struct mitflt *pMIT = (struct mitflt *) pHost;
struct ieeeflt *pIEEE = (struct ieeeflt *) pNet;
long exp,mant,sign;
sign = pHost->sign;
sign = pMIT->sign;
if( (short)(pMIT->exp < EXPMINIEEE + MIT_SB){
if( ((int)pMIT->exp) < EXPMINIEEE + MIT_SB){
exp = 0;
mant = 0;
sign = 0;
}
else{
exp = (short)pMIT->exp-MIT_SB+IEEE_SB;
exp = ((int)pMIT->exp)-MIT_SB+IEEE_SB;
mant = (pMIT->mant1<<16) | pMIT->mant2;
}
pIEEE->mant = mant;
@@ -1566,12 +1560,12 @@ void htonf(float *pHost, float *pNet)
*/
void ntohf(float *pNet, float *pHost)
{
struct mitflt *pMIT = pHost;
struct ieeeflt *pIEEE = pNet;
struct mitflt *pMIT = (struct mitflt *) pHost;
struct ieeeflt *pIEEE = (struct ieeeflt *) pNet;
long exp,mant2,mant1,sign;
*(ca_uint32_t *)pIEEE = ntohl(*(ca_uint32_t *)pIEEE);
if( (short) pIEEE->exp > EXPMAXMIT + IEEE_SB){
if( ((int)pIEEE->exp) > EXPMAXMIT + IEEE_SB){
sign = pIEEE->sign;
exp = EXPMAXMIT + MIT_SB;
mant2 = ~0;
@@ -1598,7 +1592,7 @@ void ntohf(float *pNet, float *pHost)
#endif /*CA_FLOAT_MIT*/
#ifndef CA_FLOAT_MIT
#if !defined(CA_FLOAT_MIT)
/*
* htond ()

View File

@@ -50,8 +50,8 @@ static char *sccsId = "@(#) $Id$";
void flow_control(struct ioc_in_use *piiu)
{
unsigned nbytes;
register int status;
register int busy = piiu->client_busy;
int status;
int busy = piiu->client_busy;
LOCK;

View File

@@ -79,7 +79,9 @@ int local_addr(int s, struct sockaddr_in *plcladdr)
ifconf.ifc_req = ifreq;
status = socket_ioctl(s, SIOCGIFCONF, &ifconf);
if (status < 0 || ifconf.ifc_len == 0) {
ca_printf("CAC: ioctl failed %s\n", strerror(MYERRNO));
ca_printf(
"CAC: ioctl failed because \"%s\"\n",
strerror(MYERRNO));
ifconf.ifc_len = 0;
}
@@ -145,7 +147,7 @@ int local_addr(int s, struct sockaddr_in *plcladdr)
#if 0
/*
* An alternate sloution
* An alternate solution
* for os without the if routines
*/
/*

View File

@@ -73,7 +73,6 @@ static char *sccsId = "@(#) $Id$";
#define CA_GLBLSOURCE
#include "iocinf.h"
#include "net_convert.h"
#include <netinet/tcp.h>
LOCAL void tcp_recv_msg(struct ioc_in_use *piiu);
LOCAL void cac_tcp_send_msg_piiu(struct ioc_in_use *piiu);
@@ -188,6 +187,7 @@ int net_proto
UNLOCK;
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 =
@@ -641,6 +641,8 @@ LOCAL void cac_udp_send_msg_piiu(struct ioc_in_use *piiu)
pNode = (caAddrNode *) piiu->destAddr.node.next;
while(pNode){
unsigned long actualSendCnt;
status = sendto(
piiu->sock_chan,
&piiu->send.buf[piiu->send.rdix],
@@ -649,18 +651,23 @@ LOCAL void cac_udp_send_msg_piiu(struct ioc_in_use *piiu)
&pNode->destAddr.sockAddr,
sizeof(pNode->destAddr.sockAddr));
if(status<0){
if( MYERRNO != EWOULDBLOCK &&
MYERRNO != ENOBUFS &&
MYERRNO != EINTR){
int localErrno;
localErrno = MYERRNO;
if( localErrno != EWOULDBLOCK &&
localErrno != ENOBUFS &&
localErrno != EINTR){
ca_printf(
"CAC: error on socket send() %s\n",
strerror(MYERRNO));
strerror(localErrno));
}
TAG_CONN_DOWN(piiu);
break;
}
assert(status == sendCnt);
actualSendCnt = (unsigned long) status;
assert (actualSendCnt == sendCnt);
pNode = (caAddrNode *) pNode->node.next;
}
@@ -687,6 +694,7 @@ LOCAL void cac_tcp_send_msg_piiu(struct ioc_in_use *piiu)
{
unsigned long sendCnt;
int status;
int localError;
/*
* check for shutdown in progress
@@ -715,8 +723,6 @@ LOCAL void cac_tcp_send_msg_piiu(struct ioc_in_use *piiu)
sendCnt,
0);
if(status>=0){
assert(status<=sendCnt);
piiu->sendPending = FALSE;
CAC_RING_BUFFER_READ_ADVANCE(&piiu->send, status);
@@ -729,9 +735,11 @@ LOCAL void cac_tcp_send_msg_piiu(struct ioc_in_use *piiu)
return;
}
if( MYERRNO == EWOULDBLOCK ||
MYERRNO == ENOBUFS ||
MYERRNO == EINTR){
localError = MYERRNO;
if( localError == EWOULDBLOCK ||
localError == ENOBUFS ||
localError == EINTR){
UNLOCK;
if(!piiu->sendPending){
cac_gettimeval(&piiu->timeAtSendBlock);
@@ -740,12 +748,12 @@ LOCAL void cac_tcp_send_msg_piiu(struct ioc_in_use *piiu)
return;
}
if( MYERRNO != EPIPE &&
MYERRNO != ECONNRESET &&
MYERRNO != ETIMEDOUT){
if( localError != EPIPE &&
localError != ECONNRESET &&
localError != ETIMEDOUT){
ca_printf(
"CAC: error on socket send() %s\n",
strerror(MYERRNO));
strerror(localError));
}
TAG_CONN_DOWN(piiu);
@@ -890,7 +898,6 @@ LOCAL void tcp_recv_msg(struct ioc_in_use *piiu)
return;
}
if(status>MAX_MSG_SIZE){
ca_printf( "CAC: recv_msg(): message overflow %l\n",
status-MAX_MSG_SIZE);
@@ -1174,15 +1181,15 @@ void close_ioc (struct ioc_in_use *piiu)
chix = (chid) &piiu->chidlist.node.next;
while (chix = (chid) chix->node.next) {
chix->type = TYPENOTCONN;
chix->count = 0;
chix->count = 0U;
chix->state = cs_prev_conn;
chix->id.sid = ~0L;
chix->id.sid = ~0U;
chix->ar.read_access = FALSE;
chix->ar.write_access = FALSE;
/*
* try to reconnect
*/
chix->retry = 0;
chix->retry = 0U;
}
if (piiu->chidlist.count) {
@@ -1564,6 +1571,7 @@ void caAddConfiguredAddr(ELLLIST *pList, ENV_PARAM *pEnv,
}
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);
@@ -1654,32 +1662,38 @@ void caPrintAddrList(ELLLIST *pList)
/*
* caFetchPortConfig()
*/
unsigned caFetchPortConfig(ENV_PARAM *pEnv, unsigned defaultPort)
int caFetchPortConfig(ENV_PARAM *pEnv, int defaultPort)
{
long longStatus;
long port;
long epicsParam;
int port;
longStatus = envGetLongConfigParam(pEnv, &port);
longStatus = envGetLongConfigParam(pEnv, &epicsParam);
if (longStatus!=0) {
port = defaultPort;
epicsParam = defaultPort;
ca_printf ("EPICS \"%s\" integer fetch failed\n", pEnv->name);
ca_printf ("setting \"%s\" = %ld\n", pEnv->name, port);
ca_printf ("setting \"%s\" = %ld\n", pEnv->name, epicsParam);
}
/*
* Thus must be a server port that will fit in a signed
* This must be a server port that will fit in a signed
* short
*/
if (port <= IPPORT_USERRESERVED || port>SHRT_MAX) {
if (epicsParam<=IPPORT_USERRESERVED || epicsParam>SHRT_MAX) {
ca_printf ("EPICS \"%s\" out of range\n", pEnv->name);
/*
* Quit if the port is wrong due CA coding error
*/
assert (port != defaultPort);
port = defaultPort;
ca_printf ("Setting \"%s\" = %ld\n", pEnv->name, port);
assert (epicsParam != defaultPort);
epicsParam = defaultPort;
ca_printf ("Setting \"%s\" = %ld\n", pEnv->name, epicsParam);
}
/*
* ok to clip to int here because we checked the range
*/
port = (int) epicsParam;
return port;
}

View File

@@ -85,6 +85,7 @@ HDRVERSIONID(iocinfh, "$Id$")
#include <signal.h>
#include <stdlib.h>
#include <limits.h>
#include <stdarg.h>
/*
@@ -168,8 +169,8 @@ struct pending_io_event{
typedef struct timeval ca_time;
#define LD_CA_TIME(FLOAT_TIME,PCATIME) \
((PCATIME)->tv_sec = (FLOAT_TIME), \
(PCATIME)->tv_usec = ((FLOAT_TIME)-(PCATIME)->tv_sec)*USEC_PER_SEC)
((PCATIME)->tv_sec = (long) (FLOAT_TIME), \
(PCATIME)->tv_usec = (long) ((FLOAT_TIME)-(PCATIME)->tv_sec)*USEC_PER_SEC)
/*
* dont adjust
@@ -409,6 +410,7 @@ struct ca_static{
void (*ca_connection_func)
(struct connection_handler_args);
void *ca_connection_arg;
int (*ca_printf_func)(char *pformat, va_list args);
void (*ca_fd_register_func)
(void *, SOCKET, int);
void *ca_fd_register_arg;
@@ -591,6 +593,8 @@ ca_real cac_time_diff(ca_time *pTVA, ca_time *pTVB);
ca_time cac_time_sum(ca_time *pTVA, ca_time *pTVB);
void caIOBlockFree(evid pIOBlock);
void clearChannelResources(unsigned id);
void caSetDefaultPrintfHandler ();
int ca_default_printf(char *pformat, va_list args);
/*
* !!KLUDGE!!

View File

@@ -82,7 +82,7 @@ typedef float ca_float32_t;
#define IOC_WRITE 4 /* write a channel value */
#define IOC_SNAPSHOT 5 /* snapshot of the system */
#define IOC_SEARCH 6 /* IOC channel search */
/* 7 */
#define IOC_BUILD 7 /* build - obsolete */
#define IOC_EVENTS_OFF 8 /* flow control */
#define IOC_EVENTS_ON 9 /* flow control */
#define IOC_READ_SYNC 10 /* purge old reads */
@@ -91,7 +91,7 @@ typedef float ca_float32_t;
#define IOC_RSRV_IS_UP 13 /* CA server has joined the net */
#define IOC_NOT_FOUND 14 /* channel not found */
#define IOC_READ_NOTIFY 15 /* add a one shot event */
/* 16 */
#define IOC_READ_BUILD 16 /* read and build - obsolete */
#define REPEATER_CONFIRM 17 /* registration confirmation */
#define IOC_CLAIM_CIU 18 /* client claims resource in server */
#define IOC_WRITE_NOTIFY 19 /* notify after write chan value */

View File

@@ -63,10 +63,30 @@
# endif
#endif
#if !defined(MIT_FLOAT) && !defined(CA_LITTLE_ENDIAN)
#define htond(IEEEhost, IEEEnet) (*(double *)(IEEEnet) = *(double *)(IEEEhost))
#define ntohd(IEEEnet, IEEEhost) (*(double *)(IEEEhost) = *(double *)(IEEEnet))
#define htonf(IEEEhost, IEEEnet) (*(float *)(IEEEnet) = *(float *)(IEEEhost))
#define ntohf(IEEEnet, IEEEhost) (*(float *)(IEEEhost) = *(float *)(IEEEnet))
#if defined(CA_FLOAT_IEEE) && !defined(CA_LITTLE_ENDIAN)
# define htond(IEEEhost, IEEEnet) \
(*(double *)(IEEEnet) = *(double *)(IEEEhost))
# define ntohd(IEEEnet, IEEEhost) \
(*(double *)(IEEEhost) = *(double *)(IEEEnet))
# define htonf(IEEEhost, IEEEnet) \
(*(float *)(IEEEnet) = *(float *)(IEEEhost))
# define ntohf(IEEEnet, IEEEhost) \
(*(float *)(IEEEhost) = *(float *)(IEEEnet))
#elif defined(CA_FLOAT_IEEE) && defined(CA_LITTLE_ENDIAN)
# define ntohf(NET,HOST) \
{*((u_long *)(HOST)) = ntohl(*((u_long *)(NET )));}
# define htonf(HOST,NET) \
{*((u_long *)(NET) ) = htonl(*((u_long *)(HOST)));}
# define ntohd(NET,HOST) \
{ ((u_long *)(HOST))[1] = ntohl(((u_long *)(NET))[0]) ; \
((u_long *)(HOST))[0] = ntohl(((u_long *)(NET))[1]) ;}
# define htond(HOST,NET) \
{ ((u_long *)(NET))[1] = htonl(((u_long *)(HOST))[0]) ; \
((u_long *)(NET))[0] = htonl(((u_long *)(HOST))[1]) ;}
#else
void htond(double *pHost, double *pNet);
void ntohd(double *pNet, double *pHost);
void htonf(float *pHost, float *pNet);
void ntohf(float *pNet, float *pHost);
#endif

View File

@@ -39,6 +39,9 @@ static char *sccsId = "@(#) $Id$";
#include <string.h>
#include <assert.h>
#ifdef _WINDOWS
#include <winsock.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -55,7 +58,7 @@ void caHostFromInetAddr(struct in_addr *pnet_addr, char *pBuf, unsigned size)
struct hostent *ent;
ent = gethostbyaddr(
pnet_addr,
(char *) pnet_addr,
sizeof(*pnet_addr),
AF_INET);
if(ent){

View File

@@ -24,6 +24,7 @@
* pairs reside at the same C bracket level
* .11 GeG 120992 support VMS/UCX
* .12 CJM 130794 define MYERRNO properly for UCX
* .13 CJM 311094 mods to support DEC C compiler
*
*/
@@ -46,6 +47,7 @@ static char *os_depenhSccsId = "$Id$";
# include <sys/param.h>
# include <sys/socket.h>
# include <netinet/in.h>
# include <netinet/tcp.h>
# include <net/if.h>
# define CA_OS_CONFIGURED
#endif
@@ -57,6 +59,7 @@ static char *os_depenhSccsId = "$Id$";
# include <sys/ioctl.h>
# include <sys/socket.h>
# include <netinet/in.h>
# include <netinet/tcp.h>
# include <net/if.h>
# include <systime.h>
@@ -93,9 +96,13 @@ static char *os_depenhSccsId = "$Id$";
# include <sys/types.h>
# include <sys/socket.h>
# include <netinet/in.h>
# define __TIME_LOADED /* dont include VMS CC time.h under MULTINET */
# include <netinet/tcp.h>
#if !defined(UCX)
# include <sys/time.h>
# include <tcp/errno.h>
# include <tcp/errno.h>
#else
# include <errno>
#endif
# include <ssdef>
# include <stsdef>
# include <iodef.h>
@@ -104,12 +111,12 @@ static char *os_depenhSccsId = "$Id$";
# include <descrip.h>
# define MAXHOSTNAMELEN 75
#ifdef UCX /* GeG 09-DEC-1992 */
# include <sys/ucx$inetdef.h>
# include <ucx.h>
# include <sys/ucx$inetdef.h>
# include <ucx.h>
#else
# include <net/if.h>
# include <vms/inetiodef.h>
# include <sys/ioctl.h>
# include <net/if.h>
# include <vms/inetiodef.h>
# include <sys/ioctl.h>
#endif
# define CA_OS_CONFIGURED
#endif /*VMS*/
@@ -123,7 +130,7 @@ static char *os_depenhSccsId = "$Id$";
#endif /*_WINDOWS*/
#ifndef CA_OS_CONFIGURED
#error Please define one of vxWorks, UNIX or VMS
#error Please define one of vxWorks, UNIX VMS, or _WINDOWS
#endif
/*
@@ -139,10 +146,10 @@ static char *os_depenhSccsId = "$Id$";
#elif defined(_X86_)
# define CA_FLOAT_IEEE
# define CA_LITTLE_ENDIAN
#elif (defined(__ALPHA) || defined(__alpha)) && defined(VMS)
#elif (defined(__ALPHA) && defined(VMS) || defined(__alpha)) && defined(VMS)
# define CA_FLOAT_MIT
# define CA_LITTLE_ENDIAN
#elif (defined(__ALPHA) || defined(__alpha)) && defined(UNIX)
#elif (defined(__ALPHA) && defined(UNIX) || defined(__alpha)) && defined(UNIX)
# define CA_FLOAT_IEEE
# define CA_LITTLE_ENDIAN
#else
@@ -269,7 +276,6 @@ static char *os_depenhSccsId = "$Id$";
# else
# ifdef UCX
# define MYERRNO errno
extern volatile int noshare errno ;
# else
# define MYERRNO socket_errno
# endif
@@ -286,6 +292,12 @@ static char *os_depenhSccsId = "$Id$";
#endif
#ifdef _WINDOWS
# define LOCK
# define UNLOCK
# define LOCKEVENTS
# define UNLOCKEVENTS
# define EVENTLOCKTEST (post_msg_active)
# define MAXHOSTNAMELEN 75
# define IPPORT_USERRESERVED 5000
# define EWOULDBLOCK WSAEWOULDBLOCK
# define ENOBUFS WSAENOBUFS

View File

@@ -31,14 +31,6 @@
*
*/
/*
* ANSI includes
*/
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <pwd.h>
#include <sys/param.h>
@@ -98,12 +90,10 @@ void cac_mux_io(struct timeval *ptimeout)
timeout.tv_sec = 0;
}
while(count>0);
ca_process_input_queue();
}
while(newInput);
}
log_time(char *pStr)
@@ -281,25 +271,14 @@ void ca_spawn_repeater()
exit(0);
}
/*
* ca_printf()
* caSetDefaultPrintfHandler ()
* use the normal default here
* ( see access.c )
*/
int ca_printf(char *pformat, ...)
void caSetDefaultPrintfHandler ()
{
va_list args;
int status;
va_start(args, pformat);
status = vfprintf(
stderr,
pformat,
args);
va_end(args);
return status;
ca_static->ca_printf_func = ca_default_printf;
}

View File

@@ -20,11 +20,11 @@
* Los Alamos National Laboratory
*
* Direct inqueries to:
* Andy Kozubal, AT-8, Mail Stop H820
* Jeff HIll, AT-8, Mail Stop H820
* Los Alamos National Laboratory
* Los Alamos, New Mexico 87545
* Phone: (505) 667-6508
* E-mail: kozubal@k2.lanl.gov
* Phone: (505) 665-1831
* E-mail: johill@lanl.gov
*
* PURPOSE:
* Broadcasts fan out over the LAN, but UDP does not allow
@@ -141,8 +141,9 @@ void ca_repeater()
status = local_addr(sock, &local);
if(status != OK){
ca_printf("CA Repeater: no inet interfaces online?\n");
assert(0);
ca_printf(
"CA Repeater: failed during initialization - no local IP address\n");
exit (0);
}
#ifdef DEBUG

View File

@@ -688,7 +688,7 @@ struct in_addr *pnet_addr
}
if (CA_V44(CA_PROTOCOL_VERSION,piiu->minor_version_number)) {
chan->id.sid = ntohl (piiu->curMsg.m_available);
chan->id.sid = piiu->curMsg.m_available;
}
reconnect_channel(piiu, chan);
break;

View File

@@ -97,7 +97,7 @@ void ca_sg_shutdown(struct ca_static *ca_temp)
/*
* ca_sg_create()
*/
int ca_sg_create(CA_SYNC_GID *pgid)
int APIENTRY ca_sg_create(CA_SYNC_GID *pgid)
{
int status;
CASG *pcasg;
@@ -162,7 +162,7 @@ int ca_sg_create(CA_SYNC_GID *pgid)
/*
* ca_sg_delete()
*/
int ca_sg_delete(CA_SYNC_GID gid)
int APIENTRY ca_sg_delete(CA_SYNC_GID gid)
{
int status;
CASG *pcasg;
@@ -200,7 +200,7 @@ int ca_sg_delete(CA_SYNC_GID gid)
/*
* ca_sg_block()
*/
int ca_sg_block(CA_SYNC_GID gid, ca_real timeout)
int APIENTRY ca_sg_block(CA_SYNC_GID gid, ca_real timeout)
{
struct timeval beg_time;
struct timeval cur_time;
@@ -270,8 +270,8 @@ int ca_sg_block(CA_SYNC_GID gid, ca_real timeout)
/*
* wait for asynch notification
*/
tmo.tv_sec = remaining;
tmo.tv_usec = (remaining-tmo.tv_sec)*USEC_PER_SEC;
tmo.tv_sec = (long) remaining;
tmo.tv_usec = (long) ((remaining-tmo.tv_sec)*USEC_PER_SEC);
cac_block_for_sg_completion (pcasg, &tmo);
}
pcasg->opPendCount = 0;
@@ -283,7 +283,7 @@ int ca_sg_block(CA_SYNC_GID gid, ca_real timeout)
/*
* ca_sg_reset
*/
int ca_sg_reset(CA_SYNC_GID gid)
int APIENTRY ca_sg_reset(CA_SYNC_GID gid)
{
CASG *pcasg;
@@ -305,7 +305,7 @@ int ca_sg_reset(CA_SYNC_GID gid)
/*
* ca_sg_test
*/
int ca_sg_test(CA_SYNC_GID gid)
int APIENTRY ca_sg_test(CA_SYNC_GID gid)
{
CASG *pcasg;
@@ -331,7 +331,7 @@ int ca_sg_test(CA_SYNC_GID gid)
/*
* ca_sg_array_put()
*/
int ca_sg_array_put(
int APIENTRY ca_sg_array_put(
CA_SYNC_GID gid,
chtype type,
unsigned long count,
@@ -396,7 +396,7 @@ void *pvalue)
/*
* ca_sg_array_get()
*/
int ca_sg_array_get(
int APIENTRY ca_sg_array_get(
CA_SYNC_GID gid,
chtype type,
unsigned long count,

View File

@@ -19,7 +19,7 @@ static char *sccsId = "$Id$";
#include "iocinf.h"
void ca_test_event(struct event_handler_args args)
void APIENTRY ca_test_event(struct event_handler_args args)
{
ca_printf("CAC: ~~~### in test event for [%s] ###~~~\n",args.chid+1);
ca_printf("CAC: User argument\t%x\n", args.usr);

View File

@@ -6,6 +6,8 @@
*
* GeG 09-DEC-1992 initial edit
* 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
*
*/
#ifndef _UCX_H_
@@ -70,13 +72,14 @@ typedef long fd_mask ;
#define howmany(x, y) (((x)+((y)-1))/(y))
#endif
typedef struct fd_set {
fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)] ;
} fd_set ;
/*
* Both DEC C and VAX C only allow 32 fd's at once
*/
typedef int fd_set ;
#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
#define FD_SET(n, p) (*(p) |= (1 << ((n) % NFDBITS)))
#define FD_CLR(n, p) (*(p) &= ~(1 << ((n) % NFDBITS)))
#define FD_ISSET(n, p) (*(p) & (1 << ((n) % NFDBITS)))
#define FD_ZERO(p) bzero((char *)(p), sizeof (*(p)))
#include <iodef.h>

View File

@@ -31,15 +31,6 @@
*
*/
/*
* ANSI includes
*/
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <stdLib.h>
#include <stdarg.h>
/*
* VMS includes
*/
@@ -147,7 +138,7 @@ void os_specific_sg_io_complete(CASG *pcasg)
/*
* cac_block_for_sg_completion()
*/
void cac_block_for_sg_completion(pTV)
void cac_block_for_sg_completion(CASG *pcasg, struct timeval *pTV)
{
cac_mux_io(pTV);
}
@@ -335,19 +326,12 @@ void caHostFromInetAddr(struct in_addr *pnet_addr, char *pBuf, unsigned size)
/*
* ca_printf()
* caSetDefaultPrintfHandler ()
* use the normal default here
* ( see access.c )
*/
int ca_printf(char *pformat, ...)
void caSetDefaultPrintfHandler ()
{
va_list args;
int status;
va_start(args, pformat);
status = vfprintf(stderr, pformat, args);
va_end(args);
return status;
ca_static->ca_printf_func = ca_default_printf;
}

View File

@@ -31,11 +31,10 @@
*
*/
#include <stdarg.h>
#include <callback.h>
#include "iocinf.h"
#include "remLib.h"
#include <mprintf.h>
LOCAL void ca_repeater_task();
LOCAL void ca_task_exit_tcb(WIND_TCB *ptcb);
@@ -379,6 +378,7 @@ int cac_os_depen_init(struct ca_static *pcas)
return status;
}
evuser = (void *) db_init_events();
assert(evuser);
@@ -881,40 +881,17 @@ void cac_recv_task(int tid)
/*
* caSetDefaultPrintfHandler()
*
* replace the default printf handler with a
* vxWorks specific one that calls logMsg ()
* so that:
*
* ca_printf()
*
*
* o messages go to the log file
* o messages dont get intermixed
*/
int ca_printf(char *pformat, ...)
void caSetDefaultPrintfHandler ()
{
va_list args;
int status;
va_start(args, pformat);
{
int logMsgArgs[6];
int i;
for(i=0; i< NELEMENTS(logMsgArgs); i++){
logMsgArgs[i] = va_arg(args, int);
}
status = logMsg(
pformat,
logMsgArgs[0],
logMsgArgs[1],
logMsgArgs[2],
logMsgArgs[3],
logMsgArgs[4],
logMsgArgs[5]);
}
va_end(args);
return status;
ca_static->ca_printf_func = vmprintf;
}

View File

@@ -1,6 +1,6 @@
/*
* $Id$
* Author: Jeffrey O. Hill
* Author: Jeffrey O. Hill, Chris Timossi
* hill@luke.lanl.gov
* (505) 665 1831
* Date: 9-93
@@ -31,14 +31,6 @@
*
*/
/*
* ANSI includes
*/
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include "iocinf.h"
#ifndef _WINDOWS
@@ -145,7 +137,7 @@ int cac_os_depen_init(struct ca_static *pcas)
{
int status;
ca_static = ca_temp;
ca_static = pcas;
/*
* dont allow disconnect to terminate process
@@ -229,26 +221,59 @@ void ca_spawn_repeater()
}
}
/*
* caSetDefaultPrintfHandler ()
* use the normal default here
* ( see access.c )
*/
void caSetDefaultPrintfHandler ()
{
ca_static->ca_printf_func = ca_default_printf;
}
/*
* ca_printf()
* DllMain ()
*/
int ca_printf(char *pformat, ...)
BOOL APIENTRY DllMain (HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
{
va_list args;
int status;
int status;
WSADATA WsaData;
va_start(args, pformat);
switch (dwReason) {
status = vfprintf(
stderr,
pformat,
args);
case DLL_PROCESS_ATTACH:
va_end(args);
if ((status = WSAStartup(MAKEWORD(1,1), &WsaData)) != 0)
return FALSE;
if (AllocConsole()) {
SetConsoleTitle("Channel Access Status");
freopen( "CONOUT$", "a", stderr );
fprintf(stderr, "Process attached to ca.dll R12\n");
}
break;
case DLL_PROCESS_DETACH:
if ((status = WSACleanup()) !=0)
return FALSE;
break;
case DLL_THREAD_ATTACH:
fprintf(stderr, "Thread attached to ca.dll R12\n");
break;
case DLL_THREAD_DETACH:
fprintf(stderr, "Thread detached from ca.dll R12\n");
break;
default:
break;
}
return TRUE;
return status;
}

View File

@@ -2,7 +2,7 @@ EPICS = ../../../..
include Target.include
include $(EPICS)/config/CONFIG_BASE
USR_LDLIBS = -lDb -lCom
USR_LDLIBS = -lDb -lCom -lm
USR_LDFLAGS = -L.
LEX = $(ELEX)

View File

@@ -1,6 +1,6 @@
b [a-zA-Z0-9_]
a [ \t]
d [a-zA-Z0-9_\,\./\*#\[\]%:;!|\'\-&\(\)@\?\+<>=$]
d [a-zA-Z0-9_\,\./\*#\[\]%:;!|\'\-&\(\)@\?\+<>=$\^\~]
%{

View File

@@ -190,8 +190,8 @@ void dbScanLock(struct dbCommon *precord)
/* Move range check to iocInit */
if(lset < 0 || lset >= dbScanPvt.nset) {
errMessage(S_db_badLset, "Lock Set out of range");
exit(1);
errMessage(S_db_badLset, "Lock Set out of range:dbScanLock");
taskSuspend(taskIdSelf());
}
pscanLock = dbScanPvt.pscanLock + lset;
FASTLOCK(&pscanLock->lock);
@@ -212,10 +212,9 @@ void dbScanUnlock(struct dbCommon *precord)
/* Put check in iocInit() */
if(lset<0 || lset>=dbScanPvt.nset) {
errMessage(S_db_badLset,"Lock Set out of range");
return;
errMessage(S_db_badLset,"Lock Set out of range:dbScanUnlock");
taskSuspend(taskIdSelf());
}
pscanLock = dbScanPvt.pscanLock + lset;
pscanLock->precord = NULL;
FASTUNLOCK(&pscanLock->lock);

View File

@@ -591,12 +591,12 @@ int db_post_single_event(struct event_block *pevent)
ev_que->valque[putix].sevr = sevr;
ev_que->valque[putix].time = precord->time;
/*
* use bcopy to avoid a bus error on
* use memcpy to avoid a bus error on
* union copy of char in the db at an odd
* address
*/
bcopy( pevent->paddr->pfield,
(char *)&ev_que->valque[putix].field,
memcpy( (char *)&ev_que->valque[putix].field,
pevent->paddr->pfield,
dbr_size[pevent->paddr->field_type]);
}
/* notify the event handler */
@@ -669,12 +669,12 @@ unsigned int select
ev_que->valque[putix].time = precord->time;
/*
* use bcopy to avoid a bus error on
* use memcpy to avoid a bus error on
* union copy of char in the db at an odd
* address
*/
bcopy( (char *)event->paddr->pfield,
(char *)&ev_que->valque[putix].field,
memcpy( (char *)&ev_que->valque[putix].field,
(char *)event->paddr->pfield,
dbr_size[event->paddr->field_type]);
}

View File

@@ -182,7 +182,6 @@ long dbPutField(
}
dbScanLock(precord);
status=dbPut(paddr,dbrType,pbuffer,nRequest);
if(status) recGblDbaddrError(status,paddr,"dbPutField");
if(status==0){
if((paddr->pfield==(void *)&precord->proc)
||(pfldDes->process_passive && precord->scan==0 && dbrType<DBR_PUT_ACKT)) {
@@ -266,7 +265,6 @@ long dbPutNotify(PUTNOTIFY *ppn)
}
dbScanLock(precord);
status=dbPut(paddr,dbrType,pbuffer,nRequest);
if(status) recGblDbaddrError(status,paddr,"dbPutField");
ppn->status = status;
if(status==0){
if((paddr->pfield==(void *)&precord->proc)
@@ -3530,7 +3528,7 @@ long offset;
}
return(0);
}
static long putStringEnum(paddr,pbuffer,nRequest,no_elements,offset)
struct dbAddr *paddr;
char *pbuffer;
@@ -3538,15 +3536,41 @@ long nRequest;
long no_elements;
long offset;
{
struct rset *prset;
short record_type=(paddr->record_type);
long status;
struct rset *prset;
short record_type=(paddr->record_type);
unsigned short *pfield= (unsigned short*)(paddr->pfield);
long status;
unsigned int nchoices,ind;
int nargs,nchars;
struct dbr_enumStrs enumStrs;
if((prset=GET_PRSET(pdbBase->precSup,record_type)) && (prset->put_enum_str))
return( (*prset->put_enum_str)(paddr,pbuffer) );
status=S_db_noRSET;
recGblRecSupError(status,paddr,"dbPutField","put_enum_str");
return(S_db_badDbrtype);
if((prset=GET_PRSET(pdbBase->precSup,record_type))
&& (prset->put_enum_str)) {
status = (*prset->put_enum_str)(paddr,pbuffer);
if(!status) return(0);
if(prset->get_enum_strs) {
status = (*prset->get_enum_strs)(paddr,&enumStrs);
if(!status) {
nchoices = enumStrs.no_str;
nargs = sscanf(pbuffer," %u %n",&ind,&nchars);
if(nargs==1 && nchars==strlen(pbuffer) && ind<nchoices) {
*pfield = ind;
return(0);
}
status = S_db_badChoice;
}
}else {
status=S_db_noRSET;
}
} else {
status=S_db_noRSET;
}
if(status == S_db_noRSET) {
recGblRecSupError(status,paddr,"dbPutField","put_enum_str");
} else {
recGblDbaddrError(status,paddr,"dbPut(putStringEnum)");
}
return(status);
}
static long putStringGchoice(paddr,pbuffer,nRequest,no_elements,offset)
@@ -3560,20 +3584,27 @@ long offset;
unsigned short *pfield= (unsigned short*)(paddr->pfield);
char *pchoice;
struct choiceSet *pchoiceSet;
unsigned short i;
unsigned int nchoices,ind;
int nargs,nchars;
if(no_elements!=1){
recGblDbaddrError(S_db_onlyOne,paddr,"dbPut(putStringGchoice)");
return(S_db_onlyOne);
}
if(pchoiceSet=GET_PCHOICE_SET(pdbBase->pchoiceGbl,choice_set)) {
for(i=0; i<pchoiceSet->number; i++) {
if(!(pchoice=pchoiceSet->papChoice[i])) continue;
nchoices = pchoiceSet->number;
for(ind=0; ind<nchoices; ind++) {
if(!(pchoice=pchoiceSet->papChoice[ind])) continue;
if(strcmp(pchoice,pbuffer)==0) {
*pfield=i;
*pfield = ind;
return(0);
}
}
nargs = sscanf(pbuffer," %u %n",&ind,&nchars);
if(nargs==1 && nchars==strlen(pbuffer) && ind<nchoices) {
*pfield = ind;
return(0);
}
}
recGblDbaddrError(S_db_badChoice,paddr,"dbPut(putStringGchoice)");
return(S_db_badChoice);
@@ -3589,20 +3620,27 @@ long offset;
unsigned short *pfield= (unsigned short*)(paddr->pfield);
char *pchoice;
struct choiceSet *pchoiceSet;
unsigned short i;
unsigned int nchoices,ind;
int nargs,nchars;
if(no_elements!=1){
recGblDbaddrError(S_db_onlyOne,paddr,"dbPut(putStringCchoice)");
return(S_db_onlyOne);
}
if(pchoiceSet=pdbBase->pchoiceCvt) {
for(i=0; i<pchoiceSet->number; i++) {
if(!(pchoice=pchoiceSet->papChoice[i])) continue;
nchoices = pchoiceSet->number;
for(ind=0; ind<nchoices; ind++) {
if(!(pchoice=pchoiceSet->papChoice[ind])) continue;
if(strcmp(pchoice,pbuffer)==0) {
*pfield=i;
*pfield=ind;
return(0);
}
}
nargs = sscanf(pbuffer," %u %n",&ind,&nchars);
if(nargs==1 && nchars==strlen(pbuffer) && ind<nchoices) {
*pfield = ind;
return(0);
}
}
recGblDbaddrError(S_db_badChoice,paddr,"dbPut(putStringCchoice)");
return(S_db_badChoice);
@@ -3620,7 +3658,8 @@ long offset;
char *pchoice;
struct choiceSet *pchoiceSet;
struct arrChoiceSet *parrChoiceSet;
unsigned short i;
unsigned int nchoices,ind;
int nargs,nchars;
if(no_elements!=1){
recGblDbaddrError(S_db_onlyOne,paddr,"dbPut(putStringRchoice)");
@@ -3628,13 +3667,19 @@ long offset;
}
if((parrChoiceSet=GET_PARR_CHOICE_SET(pdbBase->pchoiceRec,(paddr->record_type)))
&& (pchoiceSet=GET_PCHOICE_SET(parrChoiceSet,choice_set))) {
for(i=0; i<pchoiceSet->number; i++) {
if(!(pchoice=pchoiceSet->papChoice[i])) continue;
nchoices = pchoiceSet->number;
for(ind=0; ind<nchoices; ind++) {
if(!(pchoice=pchoiceSet->papChoice[ind])) continue;
if(strcmp(pchoice,pbuffer)==0) {
*pfield=i;
*pfield=ind;
return(0);
}
}
nargs = sscanf(pbuffer," %u %n",&ind,&nchars);
if(nargs==1 && nchars==strlen(pbuffer) && ind<nchoices) {
*pfield = ind;
return(0);
}
}
recGblDbaddrError(S_db_badChoice,paddr,"dbPut(putStringRchoice)");
return(S_db_badChoice);
@@ -3650,20 +3695,27 @@ long offset;
unsigned short *pfield= (unsigned short*)(paddr->pfield);
struct devChoiceSet *pdevChoiceSet;
char *pchoice;
unsigned short i;
unsigned int nchoices,ind;
int nargs,nchars;
if(no_elements!=1){
recGblDbaddrError(S_db_onlyOne,paddr,"dbPut(putStringDchoice)");
return(S_db_onlyOne);
}
if(pdevChoiceSet=GET_PDEV_CHOICE_SET(pdbBase->pchoiceDev,paddr->record_type)) {
for(i=0; i<pdevChoiceSet->number; i++) {
if(!(pchoice=pdevChoiceSet->papDevChoice[i]->pchoice)) continue;
nchoices = pdevChoiceSet->number;
for(ind=0; ind<nchoices; ind++) {
if(!(pchoice=pdevChoiceSet->papDevChoice[ind]->pchoice)) continue;
if(strcmp(pchoice,pbuffer)==0) {
*pfield=i;
*pfield=ind;
return(0);
}
}
nargs = sscanf(pbuffer," %u %n",&ind,&nchars);
if(nargs==1 && nchars==strlen(pbuffer) && ind<nchoices) {
*pfield = ind;
return(0);
}
}
recGblDbaddrError(S_db_badChoice,paddr,"dbPut(putStringDchoice)");
return(S_db_badChoice);
@@ -5875,7 +5927,9 @@ long dbPut(
if(special) {
if(special<100) { /*global processing*/
if(special==SPC_NOMOD) {
return(S_db_noMod);
status = S_db_noMod;
recGblDbaddrError(status,paddr,"dbPut");
return(status);
}else if(special==SPC_SCAN){
scanDelete(precord);
}

View File

@@ -1669,12 +1669,18 @@ char *pstring;
if(!(end = strchr(pstr,'N'))) return (S_dbLib_badField);
pstr = end + 1;
sscanf(pstr,"%hd",&plink->value.camacio.n);
if(!(end = strchr(pstr,'A'))) return (S_dbLib_badField);
pstr = end + 1;
sscanf(pstr,"%hd",&plink->value.camacio.a);
if(!(end = strchr(pstr,'F'))) return (S_dbLib_badField);
pstr = end + 1;
sscanf(pstr,"%hd",&plink->value.camacio.f);
if(!(end = strchr(pstr,'A'))) {
plink->value.camacio.a = 0;
} else {
pstr = end + 1;
sscanf(pstr,"%hd",&plink->value.camacio.a);
}
if(!(end = strchr(pstr,'F'))) {
plink->value.camacio.f = 0;
} else {
pstr = end + 1;
sscanf(pstr,"%hd",&plink->value.camacio.f);
}
plink->value.camacio.parm[0] = 0;
if(end = strchr(pstr,'@')) {
pstr = end + 1;

View File

@@ -389,21 +389,8 @@ long dbpf(char *pname,char *pvalue)
errMessage(status,"dbNameToAddr error");
return(1);
}
/* For enumerated types must allow for ENUM rather than string*/
/* If entire field is digits then use DBR_ENUM else DBR_STRING*/
if((addr.dbr_field_type==DBR_ENUM) && (*pvalue!=0)
&& (strspn(pvalue,"0123456789")==strlen(pvalue))) {
short value;
sscanf(pvalue,"%hu",&value);
status=dbPutField(&addr,DBR_ENUM,&value,1L);
} else {
status=dbPutField(&addr,DBR_STRING,pvalue,1L);
}
if(status) {
errMessage(status,"dbPutField error");
return(1);
}
status=dbPutField(&addr,DBR_STRING,pvalue,1L);
if(status) return(1);
status=dbgf(pname);
return(status);
}

View File

@@ -109,7 +109,7 @@ char *filename;
/* load data base record name to pvName */
str = pvName[0];
bzero(str,1000*31);
memset(str,0,1000*31);
pdbbase=dbAllocBase();
pdbentry=dbAllocEntry(pdbbase);

View File

@@ -1,5 +1,5 @@
/* devLib.c - support for allocation of common device resources */
/* @(#)devLib.c 1.2 3/30/94 */
/* @(#)$Id$*/
/*
* Original Author: Marty Kraimer
@@ -50,7 +50,7 @@
* .01 06-14-93 joh needs devAllocInterruptVector() routine
*/
static char *sccsID = "@(#)devLib.c 1.2\t3/30/94";
static char *sccsID = "@(#) $Id$";
#include <vxWorks.h>

View File

@@ -1,6 +1,17 @@
/*
* $Log$
* Revision 1.7 1995/02/02 17:15:55 jbk
* Removed the stinking message "Cannot contact master timing IOC ".
*
* Revision 1.6 1995/02/01 15:29:54 winans
* Added a type field to the configure command to disable the use of the event
* system hardware if desired.
*
* Revision 1.5 1994/12/16 15:51:21 winans
* Changed error message in the event system error handler & added a conditional
* based on a debug flag to print it... defaults to off. (Per request from MRK.)
*
* Revision 1.4 1994/10/28 20:15:10 jbk
* increased the USP packet time-out to 250ms, added a parm to the configure()
* routine to let user specify it.
@@ -66,7 +77,12 @@ LICENSING INQUIRIES MAY BE DIRECTED TO THE INDUSTRIAL TECHNOLOGY
DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000).
*/
#if 1
#define NODEBUG
#define MAKE_DEBUG 0
#else
#define MAKE_DEBUG TSdriverDebug
#endif
#define TS_DRIVER
#include <vxWorks.h>
@@ -103,8 +119,12 @@ DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000).
#include <drvTS.h>
/* #define FL M_drvSup,__FILE__,__LINE__ */
#if 0
#define FL stderr
#define errPrintf fprintf
#else
#define FL M_drvSup,__FILE__,__LINE__
#endif
/* functions used by this driver */
static long TSgetUnixTime(struct timespec*);
@@ -177,7 +197,7 @@ TSinfo TSdata = { TS_master_dead, TS_async_slave, TS_async_none,
0,NULL,
TS_SYNC_RATE_SEC,TS_CLOCK_RATE_HZ,0,TS_TIME_OUT_MS,0,
TS_MASTER_PORT,TS_SLAVE_PORT,1,0,0,
NULL, NULL,NULL };
NULL, NULL,NULL, 0 };
extern char* sysBootLine;
@@ -248,9 +268,12 @@ long TSreport()
TSconfigure() - This is the configuration routine which is meant to
be called from the vxWorks startup.cmd script before iocInit.
It's job is to set operating parameters for the time stamp support code.
JRW -- if type = 0, then try to config using event system
if type = 1, then permanantly inhibit use of the event system
*/
void TSconfigure(int master, int sync_rate_sec, int clock_rate_hz,
int master_port, int slave_port, unsigned long time_out)
int master_port, int slave_port, unsigned long time_out, int type)
{
if(master) TSdata.master_timing_IOC=1;
else TSdata.master_timing_IOC=0;
@@ -272,6 +295,8 @@ void TSconfigure(int master, int sync_rate_sec, int clock_rate_hz,
if(time_out) TSdata.time_out=time_out;
else TSdata.time_out=TS_TIME_OUT_MS;
TSdata.UserRequestedType = type;
return;
}
@@ -346,39 +371,56 @@ long TSinit()
SYM_TYPE stype;
Debug(5,"In TSinit()\n",0);
/* ------------------------------------------------------------- */
/* find the lower level event system functions */
if(symFindByName(sysSymTbl,"_ErHaveReceiver",
(char**)&TShaveReceiver,&stype)==ERROR)
TShaveReceiver = TShaveReceiverError;
if(symFindByName(sysSymTbl,"_ErGetTicks",
(char**)&TSgetTicks,&stype)==ERROR)
TSgetTicks = TSgetTicksError;
if(symFindByName(sysSymTbl,"_ErRegisterEventHandler",
(char**)&TSregisterEventHandler,&stype)==ERROR)
TSregisterEventHandler = TSregisterEventHandlerError;
if(symFindByName(sysSymTbl,"_ErRegisterErrorHandler",
(char**)&TSregisterErrorHandler,&stype)==ERROR)
TSregisterErrorHandler = TSregisterErrorHandlerError;
if(symFindByName(sysSymTbl,"_ErForceSync",
(char**)&TSforceSync,&stype)==ERROR)
TSforceSync = TSforceSoftSync;
if(symFindByName(sysSymTbl,"_ErGetTime",
(char**)&TSgetTime,&stype)==ERROR)
TSgetTime = TSgetCurrentTime;
if(symFindByName(sysSymTbl,"_ErSyncEvent",
(char**)&TSsyncEvent,&stype)==ERROR)
TSdata.sync_event=ER_EVENT_RESET_TICK;
if (TSdata.UserRequestedType == 0)
{ /* default configuration probe */
/* ------------------------------------------------------------- */
/* find the lower level event system functions */
if(symFindByName(sysSymTbl,"_ErHaveReceiver",
(char**)&TShaveReceiver,&stype)==ERROR)
TShaveReceiver = TShaveReceiverError;
if(symFindByName(sysSymTbl,"_ErGetTicks",
(char**)&TSgetTicks,&stype)==ERROR)
TSgetTicks = TSgetTicksError;
if(symFindByName(sysSymTbl,"_ErRegisterEventHandler",
(char**)&TSregisterEventHandler,&stype)==ERROR)
TSregisterEventHandler = TSregisterEventHandlerError;
if(symFindByName(sysSymTbl,"_ErRegisterErrorHandler",
(char**)&TSregisterErrorHandler,&stype)==ERROR)
TSregisterErrorHandler = TSregisterErrorHandlerError;
if(symFindByName(sysSymTbl,"_ErForceSync",
(char**)&TSforceSync,&stype)==ERROR)
TSforceSync = TSforceSoftSync;
if(symFindByName(sysSymTbl,"_ErGetTime",
(char**)&TSgetTime,&stype)==ERROR)
TSgetTime = TSgetCurrentTime;
if(symFindByName(sysSymTbl,"_ErSyncEvent",
(char**)&TSsyncEvent,&stype)==ERROR)
TSdata.sync_event=ER_EVENT_RESET_TICK;
else
TSdata.sync_event=TSsyncEvent();
/* ------------------------------------------------------------- */
}
else
TSdata.sync_event=TSsyncEvent();
{ /* inhibit probe and use of the event system */
/* ------------------------------------------------------------- */
printf("WARNING: drvTS event hardware probe inhibited by user\n");
TShaveReceiver = TShaveReceiverError;
TSgetTicks = TSgetTicksError;
TSregisterEventHandler = TSregisterEventHandlerError;
TSregisterErrorHandler = TSregisterErrorHandlerError;
TSforceSync = TSforceSoftSync;
TSgetTime = TSgetCurrentTime;
TSdata.sync_event=ER_EVENT_RESET_TICK;
}
/* set all the known information about the system */
TSdata.event_table=NULL;
@@ -488,12 +530,14 @@ long TSinit()
{
struct timespec tp;
clock_gettime(CLOCK_REALTIME,&tp);
/* this should work */
errPrintf(FL,"Failed to set time from Unix server\n");
}
if( TSsetClockFromMaster()<0 )
{
errPrintf(FL,"Could not contact a master timing IOC\n");
/* do nothing here */
/* errPrintf(FL,"Could not contact a master timing IOC\n"); */
}
else
TSdata.state = TS_master_alive;

View File

@@ -57,20 +57,26 @@
* .27 03-18-94 mcn added comments
* .28 03-23-94 mrk Added asInit
* .29 04-04-94 mcn added code for uninitialized conversions (link conversion field)
* .30 01-10-95 joh Fixed no quoted strings in resource.def problem
* .31 02-10-95 joh static => LOCAL
*/
#include <vxWorks.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <ellLib.h>
#include <errno.h>
#include <vxWorks.h>
#include <sysLib.h>
#include <symLib.h>
#include <sysSymTbl.h> /* for sysSymTbl*/
#include <logLib.h>
#include <taskLib.h>
#include <envLib.h>
#include <errnoLib.h>
#include <ellLib.h>
#include <sdrHeader.h>
#include <fast_lock.h>
#include <choice.h>
@@ -97,7 +103,7 @@
#define MODULE_TYPES_INIT 1
#include <module_types.h>
static initialized=FALSE;
LOCAL int initialized=FALSE;
/* The following is for use by interrupt routines */
int interruptAccept=FALSE;
@@ -108,15 +114,18 @@ struct dbBase *pdbBase=NULL;
long dbCommonInit();
/* define forward references*/
static long initDrvSup(void);
static long initRecSup(void);
static long initDevSup(void);
static long finishDevSup(void);
static long initDatabase(void);
static void createLockSets(void);
static short makeSameSet(struct dbAddr *paddr,short set);
static long initialProcess(void);
static long getResources(char *fname);
LOCAL long initDrvSup(void);
LOCAL long initRecSup(void);
LOCAL long initDevSup(void);
LOCAL long finishDevSup(void);
LOCAL long initDatabase(void);
LOCAL void createLockSets(void);
LOCAL short makeSameSet(struct dbAddr *paddr,short set);
LOCAL long initialProcess(void);
LOCAL long getResources(char *fname);
LOCAL int getResourceToken(FILE *fp, char *pToken, unsigned maxToken);
LOCAL int getResourceTokenInternal(FILE *fp, char *pToken, unsigned maxToken);
/*
* Initialize EPICS on the IOC.
@@ -316,7 +325,7 @@ int iocInit(char * pResourceFilename)
* Call the initialization routine (init) for each
* driver type.
*/
static long initDrvSup(void) /* Locate all driver support entry tables */
LOCAL long initDrvSup(void) /* Locate all driver support entry tables */
{
char *pname;
char name[40];
@@ -335,7 +344,7 @@ static long initDrvSup(void) /* Locate all driver support entry tables */
if (!(pdrvSup=pdbBase->pdrvSup)) {
status = S_drv_noDrvSup;
errMessage(status,"No device drivers are defined");
errMessage(status,"");
return(status);
}
@@ -354,7 +363,7 @@ static long initDrvSup(void) /* Locate all driver support entry tables */
vxstatus = symFindByName(sysSymTbl, name, (void *) &(pdrvSup->papDrvet[i]), &type);
if (vxstatus != OK) {
strcpy(message,"driver entry table not found for ");
strcpy(message,": ");
strcat(message,pname);
status = S_drv_noDrvet;
errMessage(status,message);
@@ -383,7 +392,7 @@ static long initDrvSup(void) /* Locate all driver support entry tables */
* Call the initialization routine (init) for each
* record type.
*/
static long initRecSup(void)
LOCAL long initRecSup(void)
{
char name[40];
int i;
@@ -398,7 +407,7 @@ static long initRecSup(void)
if(!(precType=pdbBase->precType)) {
status = S_rectype_noRecs;
errMessage(status,"No record types defined");
errMessage(status,"");
return(status);
}
@@ -444,7 +453,7 @@ static long initRecSup(void)
(void *) (&precSup->papRset[i]), &type);
if (vxstatus != OK) {
strcpy(message,"record support entry table not found for ");
strcpy(message,": ");
strcat(message,name);
status = S_rec_noRSET;
errMessage(status,message);
@@ -470,7 +479,7 @@ static long initRecSup(void)
* Call the initialization routine (init) for each
* device type (First Pass).
*/
static long initDevSup(void)
LOCAL long initDevSup(void)
{
char *pname;
char name[40];
@@ -485,7 +494,7 @@ static long initDevSup(void)
if (!(precDevSup = pdbBase->precDevSup)) {
status = S_dev_noDevSup;
errMessage(status,"No device support is defined");
errMessage(status,"");
return(status);
}
@@ -517,7 +526,7 @@ static long initDevSup(void)
if (vxstatus != OK) {
pdevSup->papDset[j]=NULL;
strcpy(message, "device support entry table not found for ");
strcpy(message, ": ");
strcat(message, pname);
status = S_dev_noDSET;
errMessage(status, message);
@@ -543,7 +552,7 @@ static long initDevSup(void)
* after the database records have been initialized and
* placed into lock sets.
*/
static long finishDevSup(void)
LOCAL long finishDevSup(void)
{
int i,j;
struct recDevSup *precDevSup;
@@ -575,7 +584,7 @@ static long finishDevSup(void)
return(0);
}
static long initDatabase(void)
LOCAL long initDatabase(void)
{
char name[PVNAME_SZ+FLDNAME_SZ+2];
short i,j;
@@ -609,7 +618,7 @@ static long initDatabase(void)
*/
if (!(precHeader = pdbBase->precHeader)) {
status = S_record_noRecords;
errMessage(status,"No database records are defined");
errMessage(status,"");
return(status);
}
@@ -654,7 +663,7 @@ static long initDatabase(void)
if (!prset) {
strcpy(name,precType->papName[i]);
strcat(name,"RSET");
strcpy(message,"record support entry table not found for ");
strcpy(message,": ");
strcat(message,name);
status = S_rec_noRSET;
errMessage(status,message);
@@ -837,7 +846,7 @@ static long initDatabase(void)
* lock set. Records connected by forward links are
* definately considered part of the same lockset.
*/
static void createLockSets(void)
LOCAL void createLockSets(void)
{
int i,link;
struct recLoc *precLoc;
@@ -930,7 +939,7 @@ static void createLockSets(void)
dbScanLockInit(nset);
}
static short makeSameSet(struct dbAddr *paddr, short lset)
LOCAL short makeSameSet(struct dbAddr *paddr, short lset)
{
struct dbCommon *precord = paddr->precord;
short link;
@@ -1001,7 +1010,7 @@ static short makeSameSet(struct dbAddr *paddr, short lset)
* Process database records at initialization if
* their pini (process at init) field is set.
*/
static long initialProcess(void)
LOCAL long initialProcess(void)
{
short i;
struct recHeader *precHeader;
@@ -1025,199 +1034,362 @@ static long initialProcess(void)
return(0);
}
#define MAX 128
#define MAX 256
#define SAME 0
static char *cvt_str[] = {
enum resType {
resDBF_STRING,
resDBF_SHORT,
resDBF_LONG,
resDBF_FLOAT,
resDBF_DOUBLE,
resInvalid};
LOCAL char *cvt_str[] = {
"DBF_STRING",
"DBF_SHORT",
"DBF_LONG",
"DBF_FLOAT",
"DBF_DOUBLE"
"DBF_DOUBLE",
"Invalid",
};
#define CVT_COUNT (sizeof(cvt_str) / sizeof(char*))
static long getResources(char *fname)
#define EPICS_ENV_PREFIX "EPICS_"
long getResources(char *fname)
{
FILE *fp;
int len;
int len2;
int lineNum = 0;
int i = 0;
int found = 0;
int cvType = 0;
int epicsFlag;
char buff[MAX + 1];
char name[40];
char s1[MAX];
char s2[MAX];
char s3[MAX];
char message[100];
long rtnval = 0;
char name[40];
FILE *fp;
enum resType cvType = resInvalid;
int epicsFlag;
SYM_TYPE type;
char *pSymAddr;
char *pSymAddr;
short n_short;
long n_long;
float n_float;
double n_double;
int status;
if (!fname) return (0);
if ((fp = fopen(fname, "r")) == 0) {
errMessage(-1L, "getResources: No such Resource file");
errPrintf(
-1L,
__FILE__,
__LINE__,
"No such Resource file - %s",
fname);
return (-1);
}
while ( fgets( buff, MAX, fp) != NULL) {
len = strlen(buff);
lineNum++;
if (len < 2)
goto CLEAR;
if (len >= MAX) {
sprintf(message,
"getResources: Line too long - line=%d", lineNum);
errMessage(-1L, message);
continue;
}
for (i = 0; i < len; i++) {
if (buff[i] == '!') {
goto CLEAR;
}
}
/* extract the 3 fields as strings */
if ((sscanf(buff, "%s %s %s", s1, s2, s3)) != 3) {
sprintf(message,
"getResources: Not enough fields - line=%d", lineNum);
errMessage(-1L, message);
continue;
}
found = 0;
len2 = strlen(s2);
for (i = 0; i < CVT_COUNT; i++) {
while (TRUE) {
status = getResourceToken (fp, s1, sizeof(s1));
if (status<0) {
/*
* EOF
*/
break;
}
status = getResourceToken (fp, s2, sizeof(s2));
if (status<0) {
errPrintf (
-1L,
__FILE__,
__LINE__,
"Missing resource data type field for resource=%s in file=%s",
s1,
fname);
break;
}
status = getResourceToken (fp, s3, sizeof(s3));
if (status<0) {
errPrintf (
-1L,
__FILE__,
__LINE__,
"Missing resource value field for resource=%s data type=%s file=%s",
s1,
s2,
fname);
break; /* EOF */
}
if ((strncmp(s2, cvt_str[i], len2)) == SAME) {
found = 1;
cvType = i;
for (cvType = 0; cvType < resInvalid; cvType++) {
if (strcmp(s2, cvt_str[cvType]) == SAME) {
break;
}
}
if (!found) {
sprintf(message,
"getResources: Field 2 not defined - line=%d", lineNum);
errMessage(-1L, message);
continue;
}
strcpy(name, "_");
strcat(name, s1);
rtnval = symFindByName(sysSymTbl, name, &pSymAddr, &type);
if (rtnval != OK) {
sprintf(message,
"getResources: Symbol name not found - line=%d", lineNum);
errMessage(-1L, message);
status = symFindByName(sysSymTbl, name, &pSymAddr, &type);
if (status!= OK) {
errPrintf (
-1L,
__FILE__,
__LINE__,
"Matching Symbol name not found for resource=%s",
s1);
continue;
}
if ( (strncmp(s1,"EPICS_",6)) == SAME)
epicsFlag = 1;
else
epicsFlag = 0;
status = strncmp (
s1,
EPICS_ENV_PREFIX,
strlen (EPICS_ENV_PREFIX));
if (status == SAME) {
epicsFlag = 1;
if (cvType != resDBF_STRING) {
errPrintf (
-1L,
__FILE__,
__LINE__,
"%s should be set with type DBF_STRING not type %s",
s1,
s2);
continue;
}
}
else {
epicsFlag = 0;
}
switch (cvType) {
case 0: /* DBF_STRING */
len = strlen(s3);
len2 = 20;
if (len >= len2) {
sprintf(message,
"getResources: Warning, string might exceed previous reserved space - line=%d",
lineNum);
errMessage(-1L, message);
}
if ( epicsFlag )
strncpy(pSymAddr+sizeof(void *), s3, len + 1);
else
strncpy(pSymAddr, s3, len + 1);
break;
case 1: /* DBF_SHORT */
if ((sscanf(s3, "%hd", &n_short)) != 1) {
sprintf(message,
"getResources: conversion failed - line=%d", lineNum);
errMessage(-1L, message);
continue;
}
case resDBF_STRING:
if ( epicsFlag ) {
sprintf(message,
"getResources: %s is of type DBF_STRING - line =%d",
name,lineNum);
errMessage(-1L, message);
}
else
*(short *) pSymAddr = n_short;
char *pEnv;
break;
case 2: /* DBF_LONG */
if ((sscanf(s3, "%ld", &n_long)) != 1) {
sprintf(message,
"getResources: conversion failed - line=%d", lineNum);
errMessage(-1L, message);
continue;
/*
* space for two strings, an '=' character,
* and a null termination
*/
pEnv = malloc (strlen (s3) + strlen (s1) + 2);
if (!pEnv) {
errPrintf(
-1L,
__FILE__,
__LINE__,
"Failed to set environment parameter \"%s\" to \"%s\" because \"%s\"\n",
s1,
s3,
strerror (errnoGet()));
break;
}
strcpy (pEnv, s1);
strcat (pEnv, "=");
strcat (pEnv, s3);
status = putenv (pEnv);
if (status<0) {
errPrintf(
-1L,
__FILE__,
__LINE__,
"Failed to set environment parameter \"%s\" to \"%s\" because \"%s\"\n",
s1,
s3,
strerror (errnoGet()));
}
/*
* vxWorks copies into a private buffer
* (this does not match UNIX behavior)
*/
free (pEnv);
}
if ( epicsFlag ) {
sprintf(message,
"getResources: %s is of type DBF_STRING - line =%d",
name,lineNum);
errMessage(-1L, message);
}
else
*(long *) pSymAddr = n_long;
break;
case 3: /* DBF_FLOAT */
if ((sscanf(s3, "%e", &n_float)) != 1) {
sprintf(message,
"getResources: conversion failed - line=%d", lineNum);
errMessage(-1L, message);
continue;
else{
strcpy(pSymAddr, s3);
}
if ( epicsFlag ) {
sprintf(message,
"getResources: %s is of type DBF_STRING - line =%d",
name,lineNum);
errMessage(-1L, message);
}
else
*(float *) pSymAddr = n_float;
break;
break;
case 4: /* DBF_DOUBLE */
if ((sscanf(s3, "%le", &n_double)) != 1) {
sprintf(message,
"getResources: conversion failed - line=%d", lineNum);
errMessage(-1L, message);
case resDBF_SHORT:
if (sscanf(s3, "%hd", &n_short) != 1) {
errPrintf (
-1L,
__FILE__,
__LINE__,
"Resource=%s value=%s conversion to %s failed",
s1,
s3,
cvt_str[cvType]);
continue;
}
if ( epicsFlag ) {
sprintf(message,
"getResources: %s is of type DBF_STRING - line =%d",
name,lineNum);
errMessage(-1L, message);
}
else
*(double *) pSymAddr = n_double;
*(short *) pSymAddr = n_short;
break;
case resDBF_LONG:
if (sscanf(s3, "%ld", &n_long) != 1) {
errPrintf (
-1L,
__FILE__,
__LINE__,
"Resource=%s value=%s conversion to %s failed",
s1,
s3,
cvt_str[cvType]);
continue;
}
*(long *) pSymAddr = n_long;
break;
case resDBF_FLOAT:
if (sscanf(s3, "%e", &n_float) != 1) {
errPrintf (
-1L,
__FILE__,
__LINE__,
"Resource=%s value=%s conversion to %s failed",
s1,
s3,
cvt_str[cvType]);
continue;
}
*(float *) pSymAddr = n_float;
break;
case resDBF_DOUBLE:
if (sscanf(s3, "%le", &n_double) != 1) {
errPrintf (
-1L,
__FILE__,
__LINE__,
"Resource=%s value=%s conversion to %s failed",
s1,
s3,
cvt_str[cvType]);
continue;
}
*(double *) pSymAddr = n_double;
break;
default:
sprintf(message,
"getResources: switch default reached - line=%d", lineNum);
errMessage(-1L, message);
errPrintf (
-1L,
__FILE__,
__LINE__,
"Invalid data type field=%s for resource=%s",
s2,
s1);
continue;
break;
}
CLEAR: memset(buff, '\0', MAX);
memset(s1, '\0', MAX);
memset(s2, '\0', MAX);
memset(s3, '\0', MAX);
}
fclose(fp);
return (0);
}
static gotSdrSum=FALSE;
static struct sdrSum sdrSum;
/*
* getResourceToken
*/
LOCAL int getResourceToken(FILE *fp, char *pToken, unsigned maxToken)
{
int status;
/*
* keep reading until we get a token
* (and comments have been stripped)
*/
while (TRUE) {
status = getResourceTokenInternal (fp, pToken, maxToken);
if (status < 0) {
return status;
}
if (pToken[0] != '\0') {
return status;
}
}
}
/*
* getResourceTokenInternal
*/
LOCAL int getResourceTokenInternal(FILE *fp, char *pToken, unsigned maxToken)
{
char formatString[32];
char quoteCharString[2];
int status;
quoteCharString[0] = '\0';
status = fscanf (fp, " %1[\"`'!]", quoteCharString);
if (status<0) {
return status;
}
switch (quoteCharString[0]) {
/*
* its a comment
* (consume everything up to the next new line)
*/
case '!':
{
char tmp[MAX];
sprintf(formatString, "%%%d[^\n\r\v\f]", sizeof(tmp)-1);
status = fscanf (fp, "%[^\n\r\v\f]",tmp);
pToken[0] = '\0';
if (status<0) {
return status;
}
break;
}
/*
* its a plain token
*/
case '\0':
sprintf(formatString, " %%%ds", maxToken-1);
status = fscanf (fp, formatString, pToken);
if (status!=1) {
if (status < 0){
pToken[0] = '\0';
return status;
}
}
break;
/*
* it was a quoted string
*/
default:
sprintf(
formatString,
"%%%d[^%c]",
maxToken-1,
quoteCharString[0]);
status = fscanf (fp, formatString, pToken);
if (status!=1) {
if (status < 0){
pToken[0] = '\0';
return status;
}
}
sprintf(formatString, "%%1[%c]", quoteCharString[0]);
status = fscanf (fp, formatString, quoteCharString);
if (status!=1) {
errPrintf (
-1L,
__FILE__,
__LINE__,
"Resource file syntax error: unterminated string \"%s\"",
pToken);
pToken[0] = '\0';
if (status < 0){
return status;
}
}
break;
}
return 0;
}
LOCAL int gotSdrSum=FALSE;
LOCAL struct sdrSum sdrSum;
int dbLoad(char * pfilename)
{
long status;

View File

@@ -259,13 +259,22 @@ int dbLoadRecords(char* pfilename, char* pattern, char* container)
if(is_not_inited)
{
#ifdef ERROR_STUFF
fprintf(stderr,"initing parser\n");
#endif
yyin=fp;
is_not_inited=0;
}
else
{
#ifdef ERROR_STUFF
fprintf(stderr,"restarting parser\n");
#endif
yyrestart(fp);
}
#ifdef ERROR_STUFF
fprintf(stderr,"before parser startup\n");
#endif
yyparse();
#ifndef vxWorks

View File

@@ -105,11 +105,11 @@ subst: PATTERN pattern subs
pattern: O_BRACE vars C_BRACE
{
/*
#ifdef ERROR_STUFF
int i;
for(i=0;i<var_count;i++) fprintf(stderr,"variable=(%s)\n",vars[i]);
fprintf(stderr,"var_count=%d\n",var_count);
*/
#endif
}
;
@@ -130,7 +130,9 @@ subs: subs sub
sub: WORD O_BRACE vals C_BRACE
{
sub_collect[strlen(sub_collect)-1]='\0';
/* fprintf(stderr,"dbLoadRecords(%s)\n",sub_collect); */
#ifdef ERROR_STUFF
fprintf(stderr,"dbLoadRecords(%s)\n",sub_collect);
#endif
#ifndef SUB_TOOL
if(db_file_name)
dbLoadRecords(db_file_name,sub_collect,$1);
@@ -147,7 +149,9 @@ sub: WORD O_BRACE vals C_BRACE
| O_BRACE vals C_BRACE
{
sub_collect[strlen(sub_collect)-1]='\0';
/* fprintf(stderr,"dbLoadRecords(%s)\n",sub_collect); */
#ifdef ERROR_STUFF
fprintf(stderr,"dbLoadRecords(%s)\n",sub_collect);
#endif
#ifndef SUB_TOOL
if(db_file_name)
dbLoadRecords(db_file_name,sub_collect,NULL);
@@ -199,7 +203,9 @@ var_subs: var_subs var_sub
var_sub: WORD O_BRACE sub_pats C_BRACE
{
sub_collect[strlen(sub_collect)-1]='\0';
/* fprintf(stderr,"dbLoadRecords(%s)\n",sub_collect); */
#ifdef ERROR_STUFF
fprintf(stderr,"dbLoadRecords(%s)\n",sub_collect);
#endif
#ifndef SUB_TOOL
if(db_file_name)
dbLoadRecords(db_file_name,sub_collect,$1);
@@ -216,7 +222,9 @@ var_sub: WORD O_BRACE sub_pats C_BRACE
| O_BRACE sub_pats C_BRACE
{
sub_collect[strlen(sub_collect)-1]='\0';
/* fprintf(stderr,"dbLoadRecords(%s)\n",sub_collect); */
#ifdef ERROR_STUFF
fprintf(stderr,"dbLoadRecords(%s)\n",sub_collect);
#endif
#ifndef SUB_TOOL
if(db_file_name)
dbLoadRecords(db_file_name,sub_collect,NULL);
@@ -292,7 +300,10 @@ int dbLoadTemplate(char* sub_file)
yyin=fp;
is_not_inited=0;
}
else yyrestart(fp);
else
{
yyrestart(fp);
}
yyparse();
@@ -328,8 +339,18 @@ int sub_it()
{
FILE* fp;
char var_buff[500];
#ifdef ERROR_STUFF
fprintf(stderr,"In sub_it()\n");
#endif
if( *sub_collect )
{
#ifdef ERROR_STUFF
fprintf(stderr," dbInitSubst() calling\n");
#endif
dbInitSubst(sub_collect);
}
else
{
fprintf(stderr,"No valid substitutions found in table\n");
@@ -345,10 +366,16 @@ int sub_it()
/* do the work here */
while( fgets(var_buff,200,fp)!=(char*)NULL )
{
#ifdef ERROR_STUFF
fprintf(stderr," calling dbDoSubst()\n");
#endif
dbDoSubst(var_buff,500,NULL);
fputs(var_buff,stdout);
}
#ifdef ERROR_STUFF
fprintf(stderr," calling dbFreeSubst()\n");
#endif
dbFreeSubst();
fclose(fp);
return 0;

View File

@@ -191,13 +191,19 @@ long dbInitSubst(char* parm_pattern)
/* find vars and subs */
switch(*pp)
{
case '\\': pp++; break;
case '\\': pp++; break; /* skip the next character */
case '=': subst_total++; break;
case '\"': for(++pp;*pp!='\"';pp++) if(*pp=='\\') pp++; pp++; break;
case '\"':
for(++pp;*pp && *pp!='\"';pp++);
if(*pp=='\\') pp++;
pp++;
break;
default: break;
}
}
/* fprintf(stderr,"total = %d\n",subst_total); */
#ifdef ERROR_STUFF
fprintf(stderr,"total = %d\n",subst_total);
#endif
/* allocate the substitution table */
subst = (struct var_sub*)malloc( sizeof(struct var_sub)*subst_total );
@@ -235,12 +241,12 @@ long dbInitSubst(char* parm_pattern)
}
/* debug code */
/*
#ifdef ERROR_STUFF
for(pi=0;pi<subst_total;pi++)
{
printf("table[%d]=(%s,%s)\n",pi,subst[pi].var,subst[pi].sub);
fprintf(stderr,"table[%d]=(%s,%s)\n",pi,subst[pi].var,subst[pi].sub);
}
*/
#endif
/* resolve the multiple substitutions now */
for(pi=0;pi<subst_total;pi++)
@@ -253,12 +259,12 @@ long dbInitSubst(char* parm_pattern)
}
/* more debug code */
/*
#ifdef ERROR_STUFF
for(pi=0;pi<subst_total;pi++)
{
printf("table[%d]=(%s,%s)\n",pi,subst[pi].var,subst[pi].sub);
fprintf(stderr,"table[%d]=(%s,%s)\n",pi,subst[pi].var,subst[pi].sub);
}
*/
#endif
}
else
{
@@ -276,7 +282,9 @@ static char* get_var(char** to, char* from)
pp = strpbrk(from," \t=");
*pp = '\0';
pp++;
/* fprintf(stderr,"get_var: (%s)\n",from); */
#ifdef ERROR_STUFF
fprintf(stderr,"get_var: (%s)\n",from);
#endif
*to=from;
return pp;
}
@@ -297,7 +305,9 @@ static char* get_sub(char* to, char* from)
else *cp++ = *pp;
}
*cp='\0';
/* fprintf(stderr,"get_sub: quote (%s)\n",to); */
#ifdef ERROR_STUFF
fprintf(stderr,"get_sub: quote (%s)\n",to);
#endif
pp++;
}
else
@@ -307,7 +317,9 @@ static char* get_sub(char* to, char* from)
{
*hold = '\0';
hold++;
/* fprintf(stderr,"get_sub: regular (%s)\n",pp); */
#ifdef ERROR_STUFF
fprintf(stderr,"get_sub: regular (%s)\n",pp);
#endif
}
strcpy(to,pp);

View File

@@ -181,6 +181,8 @@ struct ioCard {
#define CONST_NUM_LINKS 6
#define STATIC
STATIC int devAvme9440Report();
static unsigned short BASEADD;
#define LED_INIT 0x02
#define LED_OKRUN 0x03
@@ -206,7 +208,7 @@ struct {
DEVSUPFUN write_bo; /* output command goes here */
}devBoAvme9440={
5,
NULL,
(DEVSUPFUN) devAvme9440Report,
init,
init_bo_record,
NULL,
@@ -263,7 +265,36 @@ struct {
NULL,
read_mbbi
};
/**************************************************************************
*
* Ultra groovy and useful reporting function called from 'dbior'.
*
**************************************************************************/
STATIC int devAvme9440Report()
{
int LinkNum = 0;
int CardBase = BASEADD;
int IntVec = INT_VEC_BASE;
while (LinkNum < avme9440_num_links)
{
if (cards[LinkNum].card != NULL)
{
printf(" Link %02.2d at 0x%4.4X, IRQ 0x%2.2X, input 0x%04.4X, output 0x%04.4X\n",
LinkNum,
CardBase,
IntVec,
cards[LinkNum].card->inputData,
cards[LinkNum].card->outputData);
}
LinkNum++;
CardBase += sizeof(struct avme9440);
IntVec++;
}
return(0);
}
/**************************************************************************
*

File diff suppressed because it is too large Load Diff

View File

@@ -246,16 +246,20 @@ static int timingStudy(void)
pCmd[i]->busy = 0; /* mark message 'not in queue' */
pCmd[i]->count = 0;
#ifdef USE_162_STUFF
if (pCmd[i]->linkId < MVME162_LINK_NUM_BASE)
{
#endif
(*(drvGpib.ioctl))(pCmd[i]->linkType, pCmd[i]->linkId, pCmd[i]->bug, IBGENLINK, 0, NULL);
(*(drvGpib.ioctl))(pCmd[i]->linkType, pCmd[i]->linkId, pCmd[i]->bug, IBGETLINK, 0, &(pCmd[i]->head.pibLink));
#ifdef USE_162_STUFF
}
else
{
drv162IB_InitLink(pCmd[i]->linkId);
drv162IB_GetLink(pCmd[i]->linkId, &(pCmd[i]->head.pibLink));
}
#endif
}
else
{
@@ -291,11 +295,14 @@ static int timingStudy(void)
pCmd[i]->count++;
pCmd[i]->busy = 1; /* mark the xact as busy */
#ifdef USE_162_STUFF
if (pCmd[i]->linkId < MVME162_LINK_NUM_BASE)
#endif
(*(drvGpib.qGpibReq))(pCmd[i], IB_Q_LOW);
#ifdef USE_162_STUFF
else
drv162IB_QueueReq(pCmd[i], IB_Q_LOW);
#endif
reps--;
if (reps%10000 == 0)
{
@@ -361,11 +368,16 @@ static int sendMsg(void)
replyIsBack = FALSE;
ticks = 0;
#ifdef USE_162_STUFF
if (pCmd->linkId < MVME162_LINK_NUM_BASE)
{
#endif
(*(drvGpib.ioctl))(pCmd->linkType, pCmd->linkId, pCmd->bug, IBGENLINK, 0, NULL);
(*(drvGpib.ioctl))(pCmd->linkType, pCmd->linkId, pCmd->bug, IBGETLINK, 0, &(pCmd->head.pibLink));
(*(drvGpib.qGpibReq))(pCmd, IB_Q_LOW); /* queue the msg */
#ifdef USE_162_STUFF
}
else
{
@@ -373,6 +385,7 @@ static int sendMsg(void)
drv162IB_GetLink(pCmd->linkId, &(pCmd->head.pibLink));
drv162IB_QueueReq(pCmd, IB_Q_LOW);
}
#endif
while (!replyIsBack && (ticks < maxTicks)) /* wait for reply msg */
{
@@ -403,10 +416,15 @@ static int gpibWork(struct gpibIntCmd *pCmd)
switch (pCmd->type) {
case 'w':
case 'W': /* write the message to the GPIB listen adrs */
#ifdef USE_162_STUFF
if (pCmd->linkId < MVME162_LINK_NUM_BASE)
#endif
status =(*(drvGpib.writeIb))(pCmd->head.pibLink, pCmd->head.device, pCmd->cmd, strlen(pCmd->cmd), GITime);
#ifdef USE_162_STUFF
else
status = drv162IB_write(pCmd->head.pibLink, pCmd->head.device, pCmd->cmd, strlen(pCmd->cmd), GITime);
#endif
if (status == ERROR)
strcpy(pCmd->resp, "GPIB TIMEOUT (while talking)");
@@ -415,10 +433,14 @@ static int gpibWork(struct gpibIntCmd *pCmd)
break;
case 'r':
case 'R': /* write the command string */
#ifdef USE_162_STUFF
if (pCmd->linkId < MVME162_LINK_NUM_BASE)
#endif
status = (*(drvGpib.writeIb))(pCmd->head.pibLink, pCmd->head.device, pCmd->cmd, strlen(pCmd->cmd), GITime);
#ifdef USE_162_STUFF
else
status = drv162IB_write(pCmd->head.pibLink, pCmd->head.device, pCmd->cmd, strlen(pCmd->cmd), GITime);
#endif
if (status == ERROR)
{
@@ -430,10 +452,14 @@ static int gpibWork(struct gpibIntCmd *pCmd)
case 'i':
/* read the instrument */
pCmd->resp[0] = 0; /* clear response string */
#ifdef USE_162_STUFF
if (pCmd->linkId < MVME162_LINK_NUM_BASE)
#endif
status = (*(drvGpib.readIb))(pCmd->head.pibLink, pCmd->head.device, pCmd->resp, MAX_MSG_LENGTH, GITime);
#ifdef USE_162_STUFF
else
status = drv162IB_read(pCmd->head.pibLink, pCmd->head.device, pCmd->resp, MAX_MSG_LENGTH, GITime);
#endif
if (status == ERROR)
{

View File

@@ -35,9 +35,10 @@ SRCS.c = \
../drvComet.c\
../drvJgvtr1.c\
../drvFp.c\
../drvMvme162.c\
../drvFpm.c
# ../drvTranServ.c\
OBJS = \
module_types.o\
drvXy010.o\
@@ -69,9 +70,10 @@ OBJS = \
drvComet.o\
drvJgvtr1.o\
drvFp.o\
drvMvme162.o\
drvFpm.o
# drvTranServ.o\
PROD = drvSup
include $(EPICS)/config/RULES.Vx

View File

@@ -551,10 +551,10 @@ unsigned short card;
printf("Allen Bradley: abBtCallback Logic Error");
return;
}
(preq->callback)(preq);
pabbtrequest[link][adapter][card] = NULL;
pcard = &ab_config[link][adapter][card];
*pcard &= ~(AB_INTERFACE_TYPE|AB_INIT_BIT|AB_SENT_INIT);
pabbtrequest[link][adapter][card] = NULL;
(preq->callback)(preq);
}
int ab_bt_read(link,adapter,card,preq)

View File

@@ -338,8 +338,8 @@ register unsigned int val;
/* use structure to handle high and low short swap */
/* get current output */
work = (dio[card].dptr->port4_5 << 16)
+ dio[card].dptr->port6_7;
work = (dio[card].dptr->port6_7 << 16)
+ dio[card].dptr->port4_5;
work = (work & ~mask) | (val & mask);

View File

@@ -237,8 +237,5 @@ NIGPIB_SHORT_OFF = 0x5000;
NIGPIB_IVEC_BASE = 100;
NIGPIB_IRQ_LEVEL = 5;
MVME162_EXT_OFF = 0x40000000;
MVME162_IVEC_BASE = 104;
MVME162_IRQ_LEVEL = 5;
return(0);
}

View File

@@ -22,12 +22,12 @@ PROD = iocCore vxWorks vxWorks.sym
include $(EPICS)/config/RULES.Vx
vxWorks: $(VX_IMAGE)
$(RM) $@
cp $< .
@$(RM) $@
@cp -p $< .
vxWorks.sym: $(VX_IMAGE_SYM)
$(RM) $@
cp $< .
@$(RM) $@
@cp -p $< .
iocCore: $(IOC_CORE_OBJS)
$(LINK.c) $@ $(IOC_CORE_OBJS)

View File

@@ -5,26 +5,25 @@ include $(EPICS)/config/CONFIG_BASE
USR_CFLAGS = -D_NO_PROTO
SRCS.c = \
../arAccessLib.c ../arCSCheck.c ../arChanIO.c ../bfSubr.c \
../bucketLib.c ../calcPerform.c ../cmdSubr.c ../cvtFast.c \
../cvtNumbers.c ../ellLib.c ../envSubr.c ../errMtst.c ../errSymLib.c \
../ezsSockSubr.c ../fdmgr.c ../freeListLib.c ../genSubr.c \
../genTaskSubr.c ../gpHashLib.c ../helpSubr.c ../memDebugLib.c \
../nextFieldSubr.c ../postfix.c ../sydSubr.c ../sydSubrCA.c \
../sydSubrCF.c ../sydSubrSSF.c ../tsSubr.c errSymTbl.c ../errInc.c \
../realpath.c
../bucketLib.c ../calcPerform.c ../cvtFast.c \
../ellLib.c ../envSubr.c ../errMtst.c ../errSymLib.c \
../fdmgr.c ../freeListLib.c \
../gpHashLib.c ../memDebugLib.c \
../nextFieldSubr.c ../postfix.c \
../tsSubr.c errSymTbl.c ../errInc.c \
../realpath.c ../mprintf.c
LIBOBJS = \
tsSubr.o arAccessLib.o arCSCheck.o arChanIO.o bfSubr.o bucketLib.o \
calcPerform.o cmdSubr.o cvtFast.o cvtNumbers.o ellLib.o \
envSubr.o errMtst.o errSymLib.o errSymTbl.o ezsSockSubr.o fdmgr.o \
freeListLib.o genSubr.o genTaskSubr.o gpHashLib.o helpSubr.o \
memDebugLib.o nextFieldSubr.o postfix.o sydSubr.o sydSubrCA.o \
sydSubrCF.o sydSubrSSF.o realpath.o
tsSubr.o bucketLib.o calcPerform.o\
cvtFast.o ellLib.o\
envSubr.o errMtst.o errSymLib.o errSymTbl.o fdmgr.o \
freeListLib.o gpHashLib.o \
memDebugLib.o nextFieldSubr.o postfix.o \
realpath.o mprintf.o
LIBNAME = libCom.a
#TARGETS = cvtTest tsTest sydTest
#TARGETS = tsTest
include $(EPICS)/config/RULES.Unix
@@ -38,15 +37,9 @@ errSymTbl.c errInc.o: errInc.c
pre_build:
@test -f errInc.c || ln -s ../errInc.c errInc.c
cvtTest: cvtNumbers.o
$(LINK.c) -o $@ cvtNumbers.o -lCom -lDb -lCom -lm -s
tsTest: tsSubr.o
$(LINK.c) -o $@ tsSubr.o -lCom -lDb -lCom -lm -s
sydTest: sydSubr.o
$(LINK.c) -o $@ sydSubr.o -lCom -lca -lDb -lCom -lm -s
clean::
@$(RM) errInc.c errSymTbl.c

View File

@@ -3,27 +3,22 @@ include Target.include
include $(EPICS)/config/CONFIG_BASE
SRCS.c = \
../calcPerform.c ../cmdSubr.c ../cvtBpt.c ../cvtFast.c \
../cvtNumbers.c ../gpHashLib.c ../freeListLib.c ../ellLib.c \
../envSubr.c ../errSymLib.c ../ezsSockSubr.c ../genSubr.c \
../genTaskSubr.c ../helpSubr.c ../nextFieldSubr.c ../postfix.c \
../sydSubr.c ../sydSubrCA.c ../sydSubrCF.c ../sydSubrSSF.c \
../calcPerform.c ../cvtBpt.c ../cvtFast.c \
../gpHashLib.c ../freeListLib.c ../ellLib.c \
../envSubr.c ../errSymLib.c \
../nextFieldSubr.c ../postfix.c \
../bucketLib.c ../memDebugLib.c ../tsSubr.c ../pal.c \
../paldef.c errSymTbl.c
../paldef.c ../mprintf.c errSymTbl.c
OBJS = \
calcPerform.o cvtBpt.o cvtFast.o ellLib.o envSubr.o errSymLib.o \
errSymTbl.o genSubr.o genTaskSubr.o nextFieldSubr.o postfix.o \
bucketLib.o tsSubr.o gpHashLib.o freeListLib.o pal.o paldef.o
calcPerform.o cvtBpt.o cvtFast.o ellLib.o envSubr.o errSymLib.o \
errSymTbl.o nextFieldSubr.o postfix.o \
bucketLib.o tsSubr.o gpHashLib.o freeListLib.o pal.o paldef.o \
mprintf.o
OBJS1 = \
cmdSubr.o cvtNumbers.o cvtFast.o ezsSockSubr.o helpSubr.o
OBJS2 = \
sydSubr.o sydSubrCA.o sydSubrCF.o sydSubrSSF.o
PROD = libCom libCom1 libCom2
PROD = libCom
include $(EPICS)/config/RULES.Vx
@@ -43,10 +38,3 @@ libCom: $(OBJS)
$(RM) $@
$(LINK.c) $@ $(OBJS) $(LDLIBS)
libCom1: $(OBJS1)
$(RM) $@
$(LINK.c) $@ $(OBJS1) $(LDLIBS)
libCom2: $(OBJS2)
$(RM) $@
$(LINK.c) $@ $(OBJS2) $(LDLIBS)

View File

@@ -37,6 +37,7 @@
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
@@ -196,7 +197,7 @@ LOCAL ITEM **bucketUnsignedCompare (ITEM **ppi, const void *pId)
/*
* bucketPointerCompare()
*/
ITEM **bucketPointerCompare (ITEM **ppi, const void *pId)
LOCAL ITEM **bucketPointerCompare (ITEM **ppi, const void *pId)
{
void *ptr;
void **pItemId;
@@ -219,7 +220,7 @@ ITEM **bucketPointerCompare (ITEM **ppi, const void *pId)
/*
* bucketStringCompare ()
*/
ITEM **bucketStringCompare (ITEM **ppi, const void *pId)
LOCAL ITEM **bucketStringCompare (ITEM **ppi, const void *pId)
{
const char *pStr = pId;
ITEM *pi;
@@ -241,7 +242,7 @@ ITEM **bucketStringCompare (ITEM **ppi, const void *pId)
/*
* bucketUnsignedHash ()
*/
BUCKETID bucketUnsignedHash (BUCKET *pb, const void *pId)
LOCAL BUCKETID bucketUnsignedHash (BUCKET *pb, const void *pId)
{
const unsigned *pUId = pId;
unsigned src;
@@ -262,11 +263,10 @@ BUCKETID bucketUnsignedHash (BUCKET *pb, const void *pId)
/*
* bucketPointerHash ()
*
*/
BUCKETID bucketPointerHash (BUCKET *pb, const void *pId)
LOCAL BUCKETID bucketPointerHash (BUCKET *pb, const void *pId)
{
void * const *ppId = pId;
void * const *ppId = (void * const *) pId;
unsigned long src;
BUCKETID hashid;
@@ -292,7 +292,7 @@ BUCKETID bucketPointerHash (BUCKET *pb, const void *pId)
/*
* bucketStringHash ()
*/
BUCKETID bucketStringHash (BUCKET *pb, const void *pId)
LOCAL BUCKETID bucketStringHash (BUCKET *pb, const void *pId)
{
const char *pStr = pId;
BUCKETID hashid;

View File

@@ -37,6 +37,7 @@
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
@@ -196,7 +197,7 @@ LOCAL ITEM **bucketUnsignedCompare (ITEM **ppi, const void *pId)
/*
* bucketPointerCompare()
*/
ITEM **bucketPointerCompare (ITEM **ppi, const void *pId)
LOCAL ITEM **bucketPointerCompare (ITEM **ppi, const void *pId)
{
void *ptr;
void **pItemId;
@@ -219,7 +220,7 @@ ITEM **bucketPointerCompare (ITEM **ppi, const void *pId)
/*
* bucketStringCompare ()
*/
ITEM **bucketStringCompare (ITEM **ppi, const void *pId)
LOCAL ITEM **bucketStringCompare (ITEM **ppi, const void *pId)
{
const char *pStr = pId;
ITEM *pi;
@@ -241,7 +242,7 @@ ITEM **bucketStringCompare (ITEM **ppi, const void *pId)
/*
* bucketUnsignedHash ()
*/
BUCKETID bucketUnsignedHash (BUCKET *pb, const void *pId)
LOCAL BUCKETID bucketUnsignedHash (BUCKET *pb, const void *pId)
{
const unsigned *pUId = pId;
unsigned src;
@@ -262,11 +263,10 @@ BUCKETID bucketUnsignedHash (BUCKET *pb, const void *pId)
/*
* bucketPointerHash ()
*
*/
BUCKETID bucketPointerHash (BUCKET *pb, const void *pId)
LOCAL BUCKETID bucketPointerHash (BUCKET *pb, const void *pId)
{
void * const *ppId = pId;
void * const *ppId = (void * const *) pId;
unsigned long src;
BUCKETID hashid;
@@ -292,7 +292,7 @@ BUCKETID bucketPointerHash (BUCKET *pb, const void *pId)
/*
* bucketStringHash ()
*/
BUCKETID bucketStringHash (BUCKET *pb, const void *pId)
LOCAL BUCKETID bucketStringHash (BUCKET *pb, const void *pId)
{
const char *pStr = pId;
BUCKETID hashid;

View File

@@ -472,6 +472,10 @@ printf ("*FINISHED*\n");
*pstacktop = floor(*pstacktop);
break;
case NINT:
*pstacktop = (double)(long)((*pstacktop) >= 0 ? (*pstacktop)+0.5 : (*pstacktop)-0.5);
break;
case REL_NOT:
*pstacktop = ((*pstacktop)?0:1);
break;

View File

@@ -115,7 +115,14 @@
#define SEPERATOR 8
#define TRASH 9
#define FLOAT_PT_CONST 10
#define MINUS_OPERATOR 11
#define UNARY_MINUS_I_S_P 7
#define UNARY_MINUS_I_C_P 8
#define UNARY_MINUS_CODE UNARY_NEG
#define BINARY_MINUS_I_S_P 4
#define BINARY_MINUS_I_C_P 4
#define BINARY_MINUS_CODE SUB
/* flags end of element table */
#define END_ELEMENTS -1
@@ -149,9 +156,12 @@ static struct expression_element elements[] = {
/* element i_s_p i_c_p type_element internal_rep */
"ABS", 7, 8, UNARY_OPERATOR, ABS_VAL, /* absolute value */
"NOT", 7, 8, UNARY_OPERATOR, UNARY_NEG, /* unary negate */
"-", 7, 8, MINUS_OPERATOR, UNARY_NEG, /* unary negate (or binary op) */
"SQRT", 7, 8, UNARY_OPERATOR, SQU_RT, /* square root */
"SQR", 7, 8, UNARY_OPERATOR, SQU_RT, /* square root */
"EXP", 7, 8, UNARY_OPERATOR, EXP, /* exponential function */
"LOGE", 7, 8, UNARY_OPERATOR, LOG_E, /* log E */
"LN", 7, 8, UNARY_OPERATOR, LOG_E, /* log E */
"LOG", 7, 8, UNARY_OPERATOR, LOG_10, /* log 10 */
"ACOS", 7, 8, UNARY_OPERATOR, ACOS, /* arc cosine */
"ASIN", 7, 8, UNARY_OPERATOR, ASIN, /* arc sine */
@@ -160,6 +170,7 @@ static struct expression_element elements[] = {
"MIN", 7, 8, UNARY_OPERATOR, MIN, /* minimum of 2 args */
"CEIL", 7, 8, UNARY_OPERATOR, CEIL, /* smallest integer >= */
"FLOOR", 7, 8, UNARY_OPERATOR, FLOOR, /* largest integer <= */
"NINT", 7, 8, UNARY_OPERATOR, NINT, /* nearest integer */
"COSH", 7, 8, UNARY_OPERATOR, COSH, /* hyperbolic cosine */
"COS", 7, 8, UNARY_OPERATOR, COS, /* cosine */
"SINH", 7, 8, UNARY_OPERATOR, SINH, /* hyperbolic sine */
@@ -216,7 +227,9 @@ static struct expression_element elements[] = {
"^", 6, 6, BINARY_OPERATOR,EXPON, /* exponentiation */
"**", 6, 6, BINARY_OPERATOR,EXPON, /* exponentiation */
"+", 4, 4, BINARY_OPERATOR,ADD, /* addition */
#if 0
"-", 4, 4, BINARY_OPERATOR,SUB, /* subtraction */
#endif
"*", 5, 5, BINARY_OPERATOR,MULT, /* multiplication */
"/", 5, 5, BINARY_OPERATOR,DIV, /* division */
"%", 5, 5, BINARY_OPERATOR,MODULO, /* modulo */
@@ -305,6 +318,7 @@ short *perror;
register struct expression_element *pstacktop;
double constant;
register char *pposthold, *pc;
char in_stack_pri, in_coming_pri, code;
/* convert infix expression to upper case */
for (pc=pinfix; *pc; pc++) {
@@ -416,6 +430,38 @@ short *perror;
new_expression = FALSE;
break;
case MINUS_OPERATOR:
if (operand_needed){
/* then assume minus was intended as a unary operator */
in_coming_pri = UNARY_MINUS_I_C_P;
in_stack_pri = UNARY_MINUS_I_S_P;
code = UNARY_MINUS_CODE;
new_expression = FALSE;
}
else {
/* then assume minus was intended as a binary operator */
in_coming_pri = BINARY_MINUS_I_C_P;
in_stack_pri = BINARY_MINUS_I_S_P;
code = BINARY_MINUS_CODE;
operand_needed = TRUE;
}
/* add operators of higher or equal priority to */
/* postfix notation */
while ((pstacktop->in_stack_pri >= in_coming_pri)
&& (pstacktop >= &stack[1])){
*ppostfix++ = pstacktop->code;
pstacktop--;
}
/* add new operator to stack */
pstacktop++;
*pstacktop = *pelement;
pstacktop->in_stack_pri = in_stack_pri;
pstacktop->code = code;
break;
case SEPERATOR:
if (operand_needed){
*perror = 4;

View File

@@ -472,6 +472,10 @@ printf ("*FINISHED*\n");
*pstacktop = floor(*pstacktop);
break;
case NINT:
*pstacktop = (double)(long)((*pstacktop) >= 0 ? (*pstacktop)+0.5 : (*pstacktop)-0.5);
break;
case REL_NOT:
*pstacktop = ((*pstacktop)?0:1);
break;

View File

@@ -100,7 +100,7 @@ int cvtFloatToString(
/* whole numbers */
got_one = 0;
for (iplace = 1000000; iplace >= 1; iplace /= 10){
for (iplace = 10000000; iplace >= 1; iplace /= 10){
if (whole >= iplace){
got_one = 1;
number = whole / iplace;
@@ -178,7 +178,7 @@ int cvtDoubleToString(
/* whole numbers */
got_one = 0;
for (iplace = 1000000; iplace >= 1; iplace /= 10){
for (iplace = 10000000; iplace >= 1; iplace /= 10){
if (whole >= iplace){
got_one = 1;
number = whole / iplace;

View File

@@ -100,7 +100,7 @@ int cvtFloatToString(
/* whole numbers */
got_one = 0;
for (iplace = 1000000; iplace >= 1; iplace /= 10){
for (iplace = 10000000; iplace >= 1; iplace /= 10){
if (whole >= iplace){
got_one = 1;
number = whole / iplace;
@@ -178,7 +178,7 @@ int cvtDoubleToString(
/* whole numbers */
got_one = 0;
for (iplace = 1000000; iplace >= 1; iplace /= 10){
for (iplace = 10000000; iplace >= 1; iplace /= 10){
if (whole >= iplace){
got_one = 1;
number = whole / iplace;

View File

@@ -32,6 +32,8 @@
/* #define DEBUG_DRIVER */
#include <stdlib.h>
#include <ellLib.h>
#if !defined(NULL)

View File

@@ -32,6 +32,8 @@
/* #define DEBUG_DRIVER */
#include <stdlib.h>
#include <ellLib.h>
#if !defined(NULL)

View File

@@ -28,6 +28,8 @@
* .01 07-20-91 rac initial version
* .02 08-07-91 joh added config get for long and double C types
* .03 08-07-91 joh added config get for struct in_addr type
* .04 01-11-95 joh use getenv()/putenv() to fetch/write env
* vars under vxWorks
*
* make options
* -DvxWorks makes a version for VxWorks
@@ -60,20 +62,21 @@
*
*-***************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <netinet/in.h>
#ifdef vxWorks
# include <vxWorks.h>
# include <stdioLib.h>
# include <in.h>
# include <types.h>
#else
# include <stdio.h>
# include <stdlib.h>
# include <sys/types.h>
# include <netinet/in.h>
#include <inetLib.h>
#include <envLib.h>
#include <errnoLib.h>
#endif
#define ENV_PRIVATE_DATA
#include <envDefs.h>
#include <errMdef.h>
#include <epicsEnvParams.h>
@@ -122,11 +125,8 @@ char *pBuf; /* I pointer to parameter buffer */
char *pEnv; /* pointer to environment string */
long i;
#ifndef vxWorks
pEnv = getenv(pParam->name);
#else
pEnv = NULL;
#endif
if (pEnv == NULL)
pEnv = pParam->dflt;
if (strlen(pEnv) <= 0)
@@ -363,26 +363,64 @@ ENV_PARAM *pParam; /* I pointer to config param structure */
*
*-*/
long
envSetConfigParam(pParam, value)
ENV_PARAM *pParam; /* I pointer to config param structure */
char *value; /* I pointer to value string */
envSetConfigParam (pParam, value)
ENV_PARAM *pParam; /* I pointer to config param structure */
char *value; /* I pointer to value string */
{
#ifndef vxWorks
printf("envSetConfigParam can't be used in UNIX\n");
printf("envSetConfigParam can only be used under vxWorks\n");
return -1L;
#else
if (strlen(value) < 80)
strcpy(pParam->dflt, value);
else {
strncpy(pParam->dflt, value, 79);
pParam->dflt[79] = '\0';
}
long retCode = 0;
int status;
char *pEnv;
/*
* space for two strings, an '=' character,
* and a null termination
*/
pEnv = malloc (strlen (pParam->name) + strlen (value) + 2);
if (!pEnv) {
errPrintf(
-1L,
__FILE__,
__LINE__,
"Failed to set environment parameter \"%s\" to \"%s\" because \"%s\"\n",
pParam->name,
value,
strerror (errnoGet()));
return -1L;
}
strcpy (pEnv, pParam->name);
strcat (pEnv, "=");
strcat (pEnv, value);
status = putenv (pEnv);
if (status<0) {
errPrintf(
-1L,
__FILE__,
__LINE__,
"Failed to set environment parameter \"%s\" to \"%s\" because \"%s\"\n",
pParam->name,
value,
strerror (errnoGet()));
retCode = -1L;
}
/*
* vxWorks copies into a private buffer
* (this does not match UNIX behavior)
*/
free (pEnv);
return retCode;
#endif
return 0;
}
/*parameters meant to be modified in epicsEnvParams.h*/
epicsSetEnvParams()
int epicsSetEnvParams()
{
printf("setting EPICS environment parameters\n");
envSetConfigParam(&EPICS_TS_MIN_WEST, EPICS_TS_MIN_VALUE);
@@ -393,7 +431,8 @@ epicsSetEnvParams()
envSetConfigParam(&EPICS_IOC_LOG_FILE_NAME, EPICS_IOC_LOG_FILE_TXT);
return 0;
}
epicsPrtEnvParams()
int epicsPrtEnvParams()
{
envPrtConfigParam(&EPICS_TS_MIN_WEST);
envPrtConfigParam(&EPICS_CMD_PROTO_PORT);

View File

@@ -28,6 +28,8 @@
* .01 07-20-91 rac initial version
* .02 08-07-91 joh added config get for long and double C types
* .03 08-07-91 joh added config get for struct in_addr type
* .04 01-11-95 joh use getenv()/putenv() to fetch/write env
* vars under vxWorks
*
* make options
* -DvxWorks makes a version for VxWorks
@@ -60,20 +62,21 @@
*
*-***************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <netinet/in.h>
#ifdef vxWorks
# include <vxWorks.h>
# include <stdioLib.h>
# include <in.h>
# include <types.h>
#else
# include <stdio.h>
# include <stdlib.h>
# include <sys/types.h>
# include <netinet/in.h>
#include <inetLib.h>
#include <envLib.h>
#include <errnoLib.h>
#endif
#define ENV_PRIVATE_DATA
#include <envDefs.h>
#include <errMdef.h>
#include <epicsEnvParams.h>
@@ -122,11 +125,8 @@ char *pBuf; /* I pointer to parameter buffer */
char *pEnv; /* pointer to environment string */
long i;
#ifndef vxWorks
pEnv = getenv(pParam->name);
#else
pEnv = NULL;
#endif
if (pEnv == NULL)
pEnv = pParam->dflt;
if (strlen(pEnv) <= 0)
@@ -363,26 +363,64 @@ ENV_PARAM *pParam; /* I pointer to config param structure */
*
*-*/
long
envSetConfigParam(pParam, value)
ENV_PARAM *pParam; /* I pointer to config param structure */
char *value; /* I pointer to value string */
envSetConfigParam (pParam, value)
ENV_PARAM *pParam; /* I pointer to config param structure */
char *value; /* I pointer to value string */
{
#ifndef vxWorks
printf("envSetConfigParam can't be used in UNIX\n");
printf("envSetConfigParam can only be used under vxWorks\n");
return -1L;
#else
if (strlen(value) < 80)
strcpy(pParam->dflt, value);
else {
strncpy(pParam->dflt, value, 79);
pParam->dflt[79] = '\0';
}
long retCode = 0;
int status;
char *pEnv;
/*
* space for two strings, an '=' character,
* and a null termination
*/
pEnv = malloc (strlen (pParam->name) + strlen (value) + 2);
if (!pEnv) {
errPrintf(
-1L,
__FILE__,
__LINE__,
"Failed to set environment parameter \"%s\" to \"%s\" because \"%s\"\n",
pParam->name,
value,
strerror (errnoGet()));
return -1L;
}
strcpy (pEnv, pParam->name);
strcat (pEnv, "=");
strcat (pEnv, value);
status = putenv (pEnv);
if (status<0) {
errPrintf(
-1L,
__FILE__,
__LINE__,
"Failed to set environment parameter \"%s\" to \"%s\" because \"%s\"\n",
pParam->name,
value,
strerror (errnoGet()));
retCode = -1L;
}
/*
* vxWorks copies into a private buffer
* (this does not match UNIX behavior)
*/
free (pEnv);
return retCode;
#endif
return 0;
}
/*parameters meant to be modified in epicsEnvParams.h*/
epicsSetEnvParams()
int epicsSetEnvParams()
{
printf("setting EPICS environment parameters\n");
envSetConfigParam(&EPICS_TS_MIN_WEST, EPICS_TS_MIN_VALUE);
@@ -393,7 +431,8 @@ epicsSetEnvParams()
envSetConfigParam(&EPICS_IOC_LOG_FILE_NAME, EPICS_IOC_LOG_FILE_TXT);
return 0;
}
epicsPrtEnvParams()
int epicsPrtEnvParams()
{
envPrtConfigParam(&EPICS_TS_MIN_WEST);
envPrtConfigParam(&EPICS_CMD_PROTO_PORT);

View File

@@ -12,8 +12,6 @@
#include "dbRecType.h"
#include "dbRecords.h"
#include "tsDefs.h"
#include "arAccessLib.h"
#include "sydDefs.h"
#include "drvGpibErr.h"
#include "drvBitBusErr.h"
#include "calink.h"

View File

@@ -61,27 +61,32 @@
* .01 09-04-93 rcz Merged errMessage.c, errPrint.c, errSymFind.c
* rcz into one file (errSymLib.c) and changed method
* rcz of errSymTable lookup.
* .02 01-13-95 joh call mprintf() instead of logMsg()
* and eliminated errToLogMsg variable
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <ellLib.h>
#include <dbDefs.h>
#include <errMdef.h>
#include "errSymTbl.h"
#include <stdio.h>
#ifdef vxWorks
#include <vxWorks.h>
#include <taskLib.h>
#include <logLib.h>
#include <types.h>
#include <symLib.h>
#include <errnoLib.h>
#include <mprintf.h>
extern SYMTAB_ID statSymTbl;
#else
#include <string.h>
extern int errno;
extern int sys_nerr;
extern int sys_nerr;
extern char *sys_errlist[];
#endif
@@ -108,14 +113,14 @@ static int initialized = FALSE;
extern ERRSYMTAB_ID errSymTbl;
#ifdef vxWorks
int errToLogMsg = TRUE;
#endif
/*Declare storage for errVerbose( defined in errMdef.h)*/
int errVerbose=0;
#ifdef __STDC__
int verrPrintStatus(long status, char *pFormatString, va_list pvar);
#else
int verrPrintStatus();
#endif
/****************************************************************
@@ -213,11 +218,6 @@ va_dcl
char *pFileName;
int lineno;
#endif
#ifdef vxWorks
int id;
static int saveid = -1;
char *pname;
#endif
#ifdef __STDC__
va_start(pvar, pformat);
@@ -229,29 +229,8 @@ va_dcl
pformat = va_arg(pvar, char *);
#endif
#ifdef vxWorks
if(!errToLogMsg) {
id = taskIdSelf();
if (saveid != id) {
saveid = id;
pname = taskName(id);
printf("taskid=%x taskname=%s ", id, pname);
}
}
#endif
if(pFileName && errVerbose){
#ifdef vxWorks
if(errToLogMsg) {
logMsg("filename=\"%s\" line number=%d\n", pFileName, lineno,
NULL, NULL, NULL, NULL);
}
else{
printf("filename=\"%s\" line number=%d\n", pFileName, lineno);
}
#else
printf("filename=\"%s\" line number=%d\n", pFileName, lineno);
#endif
mprintf("filename=\"%s\" line number=%d\n", pFileName, lineno);
}
if (pformat != NULL) {
@@ -273,12 +252,7 @@ va_dcl
reformatSize = size;
}
else{
#ifdef vxWorks
logMsg("%s: calloc error\n", __FILE__,
NULL, NULL, NULL, NULL, NULL);
#else
printf("%s: calloc error\n", __FILE__);
#endif
mprintf ("%s: calloc error\n", __FILE__);
return;
}
}
@@ -369,34 +343,11 @@ va_list pvar;
strcat(name, ctxToLarge);
}
else{
fprintf(stderr,ctxToLarge);
mprintf(ctxToLarge);
}
}
#ifdef vxWorks
if(errToLogMsg){
int i;
int logMsgArgs[6];
for(i=0; i< NELEMENTS(logMsgArgs); i++){
logMsgArgs[i] = va_arg(pvar, int);
}
logMsg(
name,
logMsgArgs[0],
logMsgArgs[1],
logMsgArgs[2],
logMsgArgs[3],
logMsgArgs[4],
logMsgArgs[5]);
}
else{
vprintf(name, pvar);
}
#else
vprintf(name, pvar);
#endif
vmprintf(name, pvar);
return rtnval;
}
@@ -623,3 +574,5 @@ unsigned short endErrNum;
errSymTestPrint(errNum);
}
}

View File

@@ -61,27 +61,32 @@
* .01 09-04-93 rcz Merged errMessage.c, errPrint.c, errSymFind.c
* rcz into one file (errSymLib.c) and changed method
* rcz of errSymTable lookup.
* .02 01-13-95 joh call mprintf() instead of logMsg()
* and eliminated errToLogMsg variable
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <ellLib.h>
#include <dbDefs.h>
#include <errMdef.h>
#include "errSymTbl.h"
#include <stdio.h>
#ifdef vxWorks
#include <vxWorks.h>
#include <taskLib.h>
#include <logLib.h>
#include <types.h>
#include <symLib.h>
#include <errnoLib.h>
#include <mprintf.h>
extern SYMTAB_ID statSymTbl;
#else
#include <string.h>
extern int errno;
extern int sys_nerr;
extern int sys_nerr;
extern char *sys_errlist[];
#endif
@@ -108,14 +113,14 @@ static int initialized = FALSE;
extern ERRSYMTAB_ID errSymTbl;
#ifdef vxWorks
int errToLogMsg = TRUE;
#endif
/*Declare storage for errVerbose( defined in errMdef.h)*/
int errVerbose=0;
#ifdef __STDC__
int verrPrintStatus(long status, char *pFormatString, va_list pvar);
#else
int verrPrintStatus();
#endif
/****************************************************************
@@ -213,11 +218,6 @@ va_dcl
char *pFileName;
int lineno;
#endif
#ifdef vxWorks
int id;
static int saveid = -1;
char *pname;
#endif
#ifdef __STDC__
va_start(pvar, pformat);
@@ -229,29 +229,8 @@ va_dcl
pformat = va_arg(pvar, char *);
#endif
#ifdef vxWorks
if(!errToLogMsg) {
id = taskIdSelf();
if (saveid != id) {
saveid = id;
pname = taskName(id);
printf("taskid=%x taskname=%s ", id, pname);
}
}
#endif
if(pFileName && errVerbose){
#ifdef vxWorks
if(errToLogMsg) {
logMsg("filename=\"%s\" line number=%d\n", pFileName, lineno,
NULL, NULL, NULL, NULL);
}
else{
printf("filename=\"%s\" line number=%d\n", pFileName, lineno);
}
#else
printf("filename=\"%s\" line number=%d\n", pFileName, lineno);
#endif
mprintf("filename=\"%s\" line number=%d\n", pFileName, lineno);
}
if (pformat != NULL) {
@@ -273,12 +252,7 @@ va_dcl
reformatSize = size;
}
else{
#ifdef vxWorks
logMsg("%s: calloc error\n", __FILE__,
NULL, NULL, NULL, NULL, NULL);
#else
printf("%s: calloc error\n", __FILE__);
#endif
mprintf ("%s: calloc error\n", __FILE__);
return;
}
}
@@ -369,34 +343,11 @@ va_list pvar;
strcat(name, ctxToLarge);
}
else{
fprintf(stderr,ctxToLarge);
mprintf(ctxToLarge);
}
}
#ifdef vxWorks
if(errToLogMsg){
int i;
int logMsgArgs[6];
for(i=0; i< NELEMENTS(logMsgArgs); i++){
logMsgArgs[i] = va_arg(pvar, int);
}
logMsg(
name,
logMsgArgs[0],
logMsgArgs[1],
logMsgArgs[2],
logMsgArgs[3],
logMsgArgs[4],
logMsgArgs[5]);
}
else{
vprintf(name, pvar);
}
#else
vprintf(name, pvar);
#endif
vmprintf(name, pvar);
return rtnval;
}
@@ -623,3 +574,5 @@ unsigned short endErrNum;
errSymTestPrint(errNum);
}
}

View File

@@ -124,6 +124,8 @@ int lineNum;
#else
abort();
#endif
return (0);
}
/*+/subr**********************************************************************

305
src/libCom/mprintf.c Normal file
View File

@@ -0,0 +1,305 @@
/*
* mprintf.c
* Author: Jeffrey Hill
* Date: 1-13-95
*
* 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
*
*
* This source provides a similar service to logMsg() that
* solves some of its fundamental problems.
*
* Known problems with logMsg()
* o Does not have variable arguments.
* o Prints output at the highest priority in the system.
* o Does not queue the format string so problems result
* if the calling task reuses the format string.
* o Problems result if the format string was allocated
* on the stack (a C automatic variable).
*
*/
/*
* ANSI includes
*/
#include <stdio.h>
#include <assert.h>
#include <stdarg.h>
#include <string.h>
/*
* OS dependent includes
*/
#ifdef vxWorks
#include <semLib.h>
#include <logLib.h>
#include <intLib.h>
#include <taskLib.h>
#endif
#ifndef LOCAL
#define LOCAL static
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
/*
* mprintf header file
*/
#include <mprintf.h>
#ifdef vxWorks
typedef struct {
FILE **pppFileList[3];
SEM_ID sem;
}osDepen;
#else
typedef struct {
FILE **pppFileList[2];
}osDepen;
#endif
typedef struct mprintfContext {
int (*pPrintfISR) (char *pFormat, va_list pvar);
void (*pInit) (struct mprintfContext *pCtx);
void (*pPrintThreadName) (struct mprintfContext *pCtx, FILE *pfile);
void (*pMutexLock) (struct mprintfContext *pCtx);
void (*pMutexUnlock) (struct mprintfContext *pCtx);
FILE ***pppFileList;
osDepen os;
int initComplete;
}mpc;
LOCAL int vmprintfISR (char *pFormat, va_list pvar);
LOCAL void mprintfInit (mpc *pCtx);
LOCAL void printThreadName (mpc *pCtx, FILE *pfile);
LOCAL void mprintfMutexLock (mpc *pCtx);
LOCAL void mprintfMutexUnlock (mpc *pCtx);
#ifdef vxWorks
LOCAL FILE *stdoutRef;
extern FILE *iocLogFile;
LOCAL mpc ctx = {
vmprintfISR,
mprintfInit,
printThreadName,
mprintfMutexLock,
mprintfMutexUnlock,
ctx.os.pppFileList,
{&stdoutRef, &iocLogFile, NULL}
};
#else
LOCAL FILE *stdoutRef;
LOCAL mpc ctx = {
vmprintfISR,
mprintfInit,
printThreadName,
mprintfMutexLock,
mprintfMutexUnlock,
ctx.os.pppFileList,
{&stdoutRef, NULL}
};
#endif
LOCAL mpc *pCtx = &ctx;
/*
* mprintf ()
*/
int mprintf (char *pFormat, ...)
{
va_list pvar;
va_start (pvar, pFormat);
return vmprintf (pFormat, pvar);
}
/*
* vmprintf ()
*/
int vmprintf (char *pFormat, va_list pvar)
{
int status;
FILE ***pppFile;
status = (*pCtx->pPrintfISR) (pFormat, pvar);
if (status) {
return 0;
}
if (!pCtx->initComplete) {
(*pCtx->pInit) (pCtx);
assert (pCtx->initComplete);
}
(*pCtx->pMutexLock) (pCtx);
for (pppFile = pCtx->pppFileList; *pppFile; pppFile++){
FILE *pFile;
pFile = **pppFile;
if (pFile) {
(*pCtx->pPrintThreadName) (pCtx, pFile);
vfprintf (
pFile,
pFormat,
pvar);
fflush (pFile);
}
}
(*pCtx->pMutexUnlock) (pCtx);
return 0;
}
/*
* mprintfInit ()
*/
#ifdef vxWorks
LOCAL void mprintfInit (mpc *pCtx)
{
pCtx->os.sem = semMCreate (
SEM_Q_PRIORITY |
SEM_DELETE_SAFE |
SEM_INVERSION_SAFE);
if (pCtx->os.sem == NULL) {
return;
}
stdoutRef = stdout;
pCtx->initComplete = TRUE;
}
#else
LOCAL void mprintfInit (mpc *pCtx)
{
stdoutRef = stdout;
pCtx->initComplete = TRUE;
}
#endif
/*
* mprintfMutexLock ()
*/
#ifdef vxWorks
LOCAL void mprintfMutexLock (mpc *pCtx)
{
int status;
status = semTake (pCtx->os.sem, WAIT_FOREVER);
assert (status == OK);
}
#else
LOCAL void mprintfMutexLock (mpc *pCtx)
{
return;
}
#endif
/*
* mprintfMutexUnlock ()
*/
#ifdef vxWorks
LOCAL void mprintfMutexUnlock (mpc *pCtx)
{
int status;
status = semGive (pCtx->os.sem);
assert (status == OK);
}
#else
LOCAL void mprintfMutexUnlock (mpc *pCtx)
{
return;
}
#endif
#if defined(vxWorks)
LOCAL int vmprintfISR (char *pFormat, va_list pvar)
{
unsigned i;
int status;
int logMsgArgs[6];
if (!INT_CONTEXT()) {
return FALSE;
}
va_start (pvar, pFormat);
for (i=0; i<NELEMENTS(logMsgArgs); i++) {
logMsgArgs[i] = va_arg(pvar, int);
}
status = logMsg (pFormat,
logMsgArgs[0],
logMsgArgs[1],
logMsgArgs[2],
logMsgArgs[3],
logMsgArgs[4],
logMsgArgs[5]);
va_end (pvar);
return TRUE;
}
#else
LOCAL int vmprintfISR (char *pFormat, va_list pvar)
{
return FALSE;
}
#endif
#if defined(vxWorks)
LOCAL void printThreadName (mpc *pCtx, FILE *pfile)
{
int id;
id = taskIdSelf();
fprintf (
pfile,
"0X%x %s ",
id,
taskName(id));
return;
}
#else
LOCAL void printThreadName (mpc *pCtx, FILE *pfile)
{
return;
}
#endif

View File

@@ -132,12 +132,15 @@
* printf("command=%s, count=%d, units=%s\n", pCmd, count, pUnits);
*
*-***************************************************************************/
#include <genDefs.h>
#ifdef vxWorks
# include <vxWorks.h>
# include <stdioLib.h>
# include <ctype.h>
#else
# include <ctype.h>
# include <stdio.h>
#endif
#include <assert.h>
/*-----------------------------------------------------------------------------
* the preamble skips over leading white space, stopping either at

View File

@@ -32,7 +32,6 @@
* .05 03-06-92 jba added multiple conditional expressions ?
* .06 04-02-92 jba added CONSTANT for floating pt constants in expression
* .07 05-11-94 jba added CONST_PI, CONST_D2R, and CONST_R2D
*/
/* defines for element table */
@@ -111,4 +110,5 @@
#define CONST_PI 72
#define CONST_D2R 73
#define CONST_R2D 74
#define NINT 75
#define END_STACK -1

View File

@@ -115,7 +115,14 @@
#define SEPERATOR 8
#define TRASH 9
#define FLOAT_PT_CONST 10
#define MINUS_OPERATOR 11
#define UNARY_MINUS_I_S_P 7
#define UNARY_MINUS_I_C_P 8
#define UNARY_MINUS_CODE UNARY_NEG
#define BINARY_MINUS_I_S_P 4
#define BINARY_MINUS_I_C_P 4
#define BINARY_MINUS_CODE SUB
/* flags end of element table */
#define END_ELEMENTS -1
@@ -149,9 +156,12 @@ static struct expression_element elements[] = {
/* element i_s_p i_c_p type_element internal_rep */
"ABS", 7, 8, UNARY_OPERATOR, ABS_VAL, /* absolute value */
"NOT", 7, 8, UNARY_OPERATOR, UNARY_NEG, /* unary negate */
"-", 7, 8, MINUS_OPERATOR, UNARY_NEG, /* unary negate (or binary op) */
"SQRT", 7, 8, UNARY_OPERATOR, SQU_RT, /* square root */
"SQR", 7, 8, UNARY_OPERATOR, SQU_RT, /* square root */
"EXP", 7, 8, UNARY_OPERATOR, EXP, /* exponential function */
"LOGE", 7, 8, UNARY_OPERATOR, LOG_E, /* log E */
"LN", 7, 8, UNARY_OPERATOR, LOG_E, /* log E */
"LOG", 7, 8, UNARY_OPERATOR, LOG_10, /* log 10 */
"ACOS", 7, 8, UNARY_OPERATOR, ACOS, /* arc cosine */
"ASIN", 7, 8, UNARY_OPERATOR, ASIN, /* arc sine */
@@ -160,6 +170,7 @@ static struct expression_element elements[] = {
"MIN", 7, 8, UNARY_OPERATOR, MIN, /* minimum of 2 args */
"CEIL", 7, 8, UNARY_OPERATOR, CEIL, /* smallest integer >= */
"FLOOR", 7, 8, UNARY_OPERATOR, FLOOR, /* largest integer <= */
"NINT", 7, 8, UNARY_OPERATOR, NINT, /* nearest integer */
"COSH", 7, 8, UNARY_OPERATOR, COSH, /* hyperbolic cosine */
"COS", 7, 8, UNARY_OPERATOR, COS, /* cosine */
"SINH", 7, 8, UNARY_OPERATOR, SINH, /* hyperbolic sine */
@@ -216,7 +227,9 @@ static struct expression_element elements[] = {
"^", 6, 6, BINARY_OPERATOR,EXPON, /* exponentiation */
"**", 6, 6, BINARY_OPERATOR,EXPON, /* exponentiation */
"+", 4, 4, BINARY_OPERATOR,ADD, /* addition */
#if 0
"-", 4, 4, BINARY_OPERATOR,SUB, /* subtraction */
#endif
"*", 5, 5, BINARY_OPERATOR,MULT, /* multiplication */
"/", 5, 5, BINARY_OPERATOR,DIV, /* division */
"%", 5, 5, BINARY_OPERATOR,MODULO, /* modulo */
@@ -305,6 +318,7 @@ short *perror;
register struct expression_element *pstacktop;
double constant;
register char *pposthold, *pc;
char in_stack_pri, in_coming_pri, code;
/* convert infix expression to upper case */
for (pc=pinfix; *pc; pc++) {
@@ -416,6 +430,38 @@ short *perror;
new_expression = FALSE;
break;
case MINUS_OPERATOR:
if (operand_needed){
/* then assume minus was intended as a unary operator */
in_coming_pri = UNARY_MINUS_I_C_P;
in_stack_pri = UNARY_MINUS_I_S_P;
code = UNARY_MINUS_CODE;
new_expression = FALSE;
}
else {
/* then assume minus was intended as a binary operator */
in_coming_pri = BINARY_MINUS_I_C_P;
in_stack_pri = BINARY_MINUS_I_S_P;
code = BINARY_MINUS_CODE;
operand_needed = TRUE;
}
/* add operators of higher or equal priority to */
/* postfix notation */
while ((pstacktop->in_stack_pri >= in_coming_pri)
&& (pstacktop >= &stack[1])){
*ppostfix++ = pstacktop->code;
pstacktop--;
}
/* add new operator to stack */
pstacktop++;
*pstacktop = *pelement;
pstacktop->in_stack_pri = in_stack_pri;
pstacktop->code = code;
break;
case SEPERATOR:
if (operand_needed){
*perror = 4;

View File

@@ -37,6 +37,7 @@
* .09 02-09-94 jbk tsLocalTime() now calls TScurrentTimeStamp() vxWorks
* for the EPOCH year
* .10 05-04-94 pg HPUX cpp changes. (elif to else and if)
* .11 01-09-95 joh fixed ts min west out of range test
*
* make options
* -DvxWorks makes a version for VxWorks
@@ -107,25 +108,28 @@
* 4.2 BSD.)
*-***************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#ifdef vxWorks
# include <vxWorks.h>
# include <stdioLib.h>
# include <strLib.h>
# include <ctype.h>
#else
#if VMS
# include <sys/time.h>
#else
# include <sys/time.h>
# include <stdio.h>
# include <string.h>
#if 0
# include <strings.h>
# include <ctype.h>
#endif
#endif
#endif
#ifndef INC_genDefs_h
# include <genDefs.h> /* provides assert() */
#endif
# include <assert.h>
#include <envDefs.h>
#define TS_PRIVATE_DATA
#include <tsDefs.h>
@@ -361,7 +365,7 @@ date()
*
*-*/
static
sunday(day, leap, dayYear, dayOfWeek)
int sunday(day, leap, dayYear, dayOfWeek)
int day; /* I day of year to find closest Sunday */
int leap; /* I 0, 1 for not leap year, leap year, respectively */
int dayYear; /* I known day of year */
@@ -600,10 +604,6 @@ TS_STAMP *pStamp; /* O pointer to time stamp buffer */
return TScurrentTimeStamp((struct timespec*)pStamp);
# endif
#else
#if VMS
assert(0); /* not available on VMS */
assert(pStamp != NULL);
#else /* SunOS */
struct timeval curtime;
assert(pStamp != NULL);
@@ -613,7 +613,6 @@ TS_STAMP *pStamp; /* O pointer to time stamp buffer */
pStamp->nsec = ( curtime.tv_usec/1000 ) * 1000000;
pStamp->secPastEpoch = curtime.tv_sec - TS_EPOCH_SEC_PAST_1970;
}
#endif
#endif
pStamp->nsec = pStamp->nsec - (pStamp->nsec % TS_TRUNC);
@@ -874,7 +873,7 @@ tsInitMinWest()
if (envGetLongConfigParam(&EPICS_TS_MIN_WEST, &tsMinWest) != 0)
error = 1;
else
if (tsMinWest > 1380 && tsMinWest < -1380)
if (tsMinWest > 720 || tsMinWest < -720 )
error = 1;
if (error) {
(void)printf(
@@ -899,7 +898,9 @@ struct tsDetail *pT; /* pointer to time structure for conversion */
tsInitMinWest();
assert(pStamp != NULL);
assert(pStamp->secPastEpoch >= tsMinWest * 60);
assert( (tsMinWest >= -720 && tsMinWest <= 720 ));
assert( (tsMinWest >= 0 && (pStamp->secPastEpoch >= (unsigned long)(tsMinWest * 60))) ||
(tsMinWest < 0) );
assert(pT != NULL);
/*----------------------------------------------------------------------------
@@ -1373,10 +1374,8 @@ TS_STAMP *pStamp; /* O time stamp corresponding to text */
char **pText; /* IO ptr to ptr to string containing time and date */
{
long retStat=S_ts_OK;/* status return to caller */
long stat; /* status from calls */
struct tsDetail t; /* detailed breakdown of text */
TS_STAMP stamp; /* temp for building time stamp */
char *pField; /* pointer to field */
char delim; /* delimiter character */
int count; /* count from scan of next field */
long nsec; /* temp for nano-seconds */

View File

@@ -3,9 +3,9 @@ include Target.include
include $(EPICS)/config/CONFIG_BASE
SRCS.c = ../iocLogClient.c ../veclist.c
SRCS.c = ../iocLogClient.c ../veclist.c
OBJS = veclist.o iocLogClient.o
OBJS = veclist.o iocLogClient.o
PROD = vxComLib

View File

@@ -32,19 +32,31 @@
* -----------------
* .00 joh 080791 Created
* .01 joh 081591 Added epics env config
* .02 joh 011995 Allow stdio also
*/
#include <string.h>
#include <stdio.h>
#include <vxWorks.h>
#include <ioLib.h>
#include <taskLib.h>
#include <socket.h>
#include <in.h>
#include <inetLib.h>
#include <errnoLib.h>
#include <logLib.h>
#include <sockLib.h>
#include <envDefs.h>
int iocLogFD = ERROR;
int iocLogDisable;
FILE *iocLogFile = NULL;
int iocLogFD = ERROR;
int iocLogDisable;
static long ioc_log_port;
static struct in_addr ioc_log_addr;
@@ -73,8 +85,12 @@ iocLogInit()
status = getConfig();
if(status<0){
logMsg("iocLogClient: EPICS environment under specified\n");
logMsg("iocLogClient: failed to initialize\n");
logMsg (
"iocLogClient: EPICS environment under specified\n",
0,0,0,0,0,0);
logMsg (
"iocLogClient: failed to initialize\n",
0,0,0,0,0,0);
return ERROR;
}
@@ -83,7 +99,9 @@ iocLogInit()
SOCK_STREAM, /* type */
0); /* deflt proto */
if (sock < 0){
logMsg("iocLogClient: no socket errno %d\n", errnoGet(0));
logMsg( "iocLogClient: no socket errno %d\n",
errnoGet(),
0,0,0,0,0);
return ERROR;
}
@@ -99,21 +117,26 @@ iocLogInit()
/* connect */
status = connect(
sock,
&addr,
sizeof addr);
(struct sockaddr *)&addr,
sizeof(addr));
if (status < 0) {
char name[INET_ADDR_LEN];
inet_ntoa_b(addr.sin_addr, name);
logMsg("iocLogClient: unable to connect to `%s' at port %d\n",
name,
addr.sin_port);
printErrno(errnoGet(0));
logMsg(
"iocLogClient: unable to connect to %s port %d because \"%s\"\n",
(int) name,
addr.sin_port,
(int) strerror(errnoGet()),
0,0,0);
close(sock);
return ERROR;
}
logFdAdd(sock);
logFdAdd (sock);
iocLogFile = fdopen (sock, "a");
iocLogFD = sock;
return OK;
@@ -131,9 +154,7 @@ iocLogInit()
static int
getConfig()
{
char inet_address_string[64];
long status;
char *pstring;
status = envGetLongConfigParam(
&EPICS_IOC_LOG_PORT,
@@ -166,8 +187,9 @@ static void
failureNoptify(pparam)
ENV_PARAM *pparam;
{
logMsg( "IocLogClient: EPICS environment variable `%s' undefined\n",
pparam->name);
logMsg( "IocLogClient: EPICS environment variable \"%s\" undefined\n",
(int) pparam->name,
0,0,0,0,0);
}

View File

@@ -33,7 +33,7 @@
#include "sysSymTbl.h"
static char *sccsID =
"@(#)veclist.c 1.10\t1/3/94 J. Hill hill@atdiv.lanl.gov";
"@(#) $Id$";
/*
*

View File

@@ -1,5 +1,8 @@
/* $Id$
* $Log$
* Revision 1.5 1994/10/05 18:28:17 jba
* Renamed version.h to epicsVersion.h
*
* Revision 1.4 1994/08/18 04:34:42 bordua
* Added some spaces to make output look good.
*
@@ -15,7 +18,7 @@
#include <epicsVersion.h>
char *epicsRelease= "@(#)EPICS IOC CORE $Date$";
char *epicsRelease= "@(#)EPICS IOC CORE";
char *epicsRelease1 = epicsReleaseVersion;
coreRelease()
{

View File

@@ -304,6 +304,7 @@ struct dfanoutRecord *pdfanout;
long status;
for(i=0, plink=&(pdfanout->outa); i<OUT_ARG_MAX; i++, plink++) {
nRequest=1;
status=recGblPutLinkValue(plink,(void *)pdfanout,DBR_LONG,
&(pdfanout->val),&nRequest);
if (!RTN_SUCCESS(status)) return(-1);

View File

@@ -387,6 +387,7 @@ struct gsubRecord *psub;
long status;
for(i=0, plink=&psub->inpa, pvalue=&psub->a; i<ARG_MAX; i++, plink++, pvalue++) {
nRequest=1;
status=recGblGetLinkValue(plink,(void *)psub,DBR_FLOAT,
pvalue,&options,&nRequest);
if (!RTN_SUCCESS(status)) return(-1);

View File

@@ -128,13 +128,14 @@ static void init_common(pmbbi)
struct mbbiRecord *pmbbi;
{
unsigned long *pstate_values;
char *pstate_string;
short i;
/* determine if any states are defined */
pstate_values = &(pmbbi->zrvl);
pstate_values = &(pmbbi->zrvl); pstate_string = pmbbi->zrst;
pmbbi->sdef = FALSE;
for (i=0; i<16; i++) {
if (*(pstate_values+i) != 0) {
for (i=0; i<16; i++, pstate_string += sizeof(pmbbi->zrst)) {
if((*(pstate_values+i) != 0) || (*pstate_string !='\0')) {
pmbbi->sdef = TRUE;
return;
}

View File

@@ -301,6 +301,7 @@ static long readValue(pmbbiDirect)
return(status);
}
if (pmbbiDirect->simm == YES){
nRequest=1;
status=recGblGetLinkValue(&(pmbbiDirect->siol),
(void *)pmbbiDirect,DBR_USHORT,&(pmbbiDirect->sval),&options,&nRequest);
if (status==0){

View File

@@ -136,13 +136,14 @@ static void init_common(pmbbo)
struct mbboRecord *pmbbo;
{
unsigned long *pstate_values;
char *pstate_string;
short i;
/* determine if any states are defined */
pstate_values = &(pmbbo->zrvl);
pstate_values = &(pmbbo->zrvl); pstate_string = pmbbo->zrst;
pmbbo->sdef = FALSE;
for (i=0; i<16; i++) {
if (*(pstate_values+i)!= 0) {
for (i=0; i<16; i++, pstate_string += sizeof(pmbbo->zrst)) {
if((*(pstate_values+i)!= 0) || (*pstate_string !='\0')) {
pmbbo->sdef = TRUE;
return;
}

View File

@@ -347,6 +347,7 @@ static long writeValue(pmbboDirect)
return(status);
}
if (pmbboDirect->simm == YES){
nRequest=1;
status=recGblPutLinkValue(&(pmbboDirect->siol),
(void *)pmbboDirect,DBR_USHORT,&(pmbboDirect->val),&nRequest);
} else {

View File

@@ -45,9 +45,12 @@
* seems more intuitive.
* .08 12-06-94 nda added support for .FFO .When set to 1, frzFlag values
* are saved in recPvtStruct. Restored when FFO set to 0.
* .09 02-02-95 nda fixed order of posting monitors to be what people
* expect (i.e. .cpt, .pxdv, .dxcv)
* .10 02-10-95 nda fixed on-the-fly so 1st step is to end position
*/
#define VERSION 1.08
#define VERSION 1.10
@@ -360,8 +363,10 @@ static long process(pscan)
}
pscan->pxsc = pscan->exsc;
pscan->pact = FALSE;
recGblResetAlarms(pscan);
recGblGetTimeStamp(pscan);
pscan->pact = FALSE;
return(status);
}
@@ -793,6 +798,22 @@ static void checkMonitors(pscan)
if(((now - pscan->tolp) > MIN_MON) ||
((pscan->pxsc == 1) && (pscan->exsc == 0))) {
pscan->tolp = now;
if(fabs(pscan->d1lv - pscan->d1cv) > 0) {
db_post_events(pscan,&pscan->d1cv, DBE_VALUE);
pscan->d1lv = pscan->d1cv;
}
if(fabs(pscan->d2lv - pscan->d2cv) > 0) {
db_post_events(pscan,&pscan->d2cv, DBE_VALUE);
pscan->d2lv = pscan->d2cv;
}
if(fabs(pscan->d3lv - pscan->d3cv) > 0) {
db_post_events(pscan,&pscan->d3cv, DBE_VALUE);
pscan->d3lv = pscan->d3cv;
}
if(fabs(pscan->d4lv - pscan->d4cv) > 0) {
db_post_events(pscan,&pscan->d4cv, DBE_VALUE);
pscan->d4lv = pscan->d4cv;
}
if(pscan->pcpt != pscan->cpt) {
db_post_events(pscan,&pscan->cpt, DBE_VALUE);
pscan->pcpt = pscan->cpt;
@@ -829,22 +850,6 @@ static void checkMonitors(pscan)
db_post_events(pscan,&pscan->r4cv, DBE_VALUE);
pscan->r4lv = pscan->r4cv;
}
if(fabs(pscan->d1lv - pscan->d1cv) > 0) {
db_post_events(pscan,&pscan->d1cv, DBE_VALUE);
pscan->d1lv = pscan->d1cv;
}
if(fabs(pscan->d2lv - pscan->d2cv) > 0) {
db_post_events(pscan,&pscan->d2cv, DBE_VALUE);
pscan->d2lv = pscan->d2cv;
}
if(fabs(pscan->d3lv - pscan->d3cv) > 0) {
db_post_events(pscan,&pscan->d3cv, DBE_VALUE);
pscan->d3lv = pscan->d3cv;
}
if(fabs(pscan->d4lv - pscan->d4cv) > 0) {
db_post_events(pscan,&pscan->d4cv, DBE_VALUE);
pscan->d4lv = pscan->d4cv;
}
}
if (pscan->pxsc != pscan->exsc)
@@ -1008,6 +1013,7 @@ struct scanRecord *pscan;
}
}
if(!pscan->r2nv) {
nRequest = 1;
status = dbGet(pscan->r2db, DBR_FLOAT, &(pscan->r2cv),
&options, &nRequest, NULL);
if((pscan->r2dl > 0) &&
@@ -1019,6 +1025,7 @@ struct scanRecord *pscan;
}
}
if(!pscan->r3nv) {
nRequest = 1;
status = dbGet(pscan->r3db, DBR_FLOAT, &(pscan->r3cv),
&options, &nRequest, NULL);
if((pscan->r3dl > 0) &&
@@ -1030,6 +1037,7 @@ struct scanRecord *pscan;
}
}
if(!pscan->r4nv) {
nRequest = 1;
status = dbGet(pscan->r4db, DBR_FLOAT, &(pscan->r4cv),
&options, &nRequest, NULL);
if((pscan->r4dl > 0) &&
@@ -1060,18 +1068,22 @@ struct scanRecord *pscan;
status = 0;
if(!pscan->d1nv) {
/* dbAddr is valid */
nRequest = 1;
status |= dbGet(pscan->d1db, DBR_FLOAT, &(pscan->d1cv),
&options, &nRequest, NULL);
} else pscan->d1cv = 0;
if(!pscan->d2nv) {
nRequest = 1;
status |= dbGet(pscan->d2db, DBR_FLOAT,
&(pscan->d2cv), &options, &nRequest, NULL);
} else pscan->d2cv = 0;
if(!pscan->d3nv) {
nRequest = 1;
status |= dbGet(pscan->d3db, DBR_FLOAT, &(pscan->d3cv),
&options, &nRequest, NULL);
} else pscan->d3cv = 0;
if(!pscan->d4nv) {
nRequest = 1;
status |= dbGet(pscan->d4db, DBR_FLOAT, &(pscan->d4cv),
&options, &nRequest, NULL);
} else pscan->d4cv = 0;
@@ -1096,8 +1108,8 @@ struct scanRecord *pscan;
pscan->p1dv = pscan->p1pa[pscan->cpt];
}
else {
/* this is on-the-fly, so set to second position */
pscan->p1dv = pscan->p1sp + pscan->p1si;
/* this is on-the-fly, so set to end position */
pscan->p1dv = pscan->p1ep;
pscan->p1pa[pscan->cpt] = pscan->p1dv;
}
if(pscan->p2sm == REC_SCAN_MO_LIN) {
@@ -1108,8 +1120,8 @@ struct scanRecord *pscan;
pscan->p2dv = pscan->p2pa[pscan->cpt];
}
else {
/* this is on-the-fly, so set to second position */
pscan->p2dv = pscan->p2sp + pscan->p2si;
/* this is on-the-fly, so set to end position */
pscan->p2dv = pscan->p2ep;
pscan->p2pa[pscan->cpt] = pscan->p2dv;
}
if(pscan->p3sm == REC_SCAN_MO_LIN) {
@@ -1120,8 +1132,8 @@ struct scanRecord *pscan;
pscan->p3dv = pscan->p3pa[pscan->cpt];
}
else {
/* this is on-the-fly, so set to second position */
pscan->p3dv = pscan->p3sp + pscan->p3si;
/* this is on-the-fly, so set to end position */
pscan->p3dv = pscan->p3ep;
pscan->p3pa[pscan->cpt] = pscan->p3dv;
}
if(pscan->p4sm == REC_SCAN_MO_LIN) {
@@ -1132,8 +1144,8 @@ struct scanRecord *pscan;
pscan->p4dv = pscan->p4pa[pscan->cpt];
}
else {
/* this is on-the-fly, so set to second position */
pscan->p4dv = pscan->p4sp + pscan->p4si;
/* this is on-the-fly, so set to end position */
pscan->p4dv = pscan->p4ep;
pscan->p4pa[pscan->cpt] = pscan->p4dv;
}
@@ -1859,14 +1871,17 @@ static void checkScanLimits(pscan)
&options, &nRequest, NULL);
}
if(!pscan->p2nv) {
nRequest = 1;
status = dbGet(pscan->p2db, DBR_FLOAT, precPvt->pP2Limits,
&options, &nRequest, NULL);
}
if(!pscan->p3nv) {
nRequest = 1;
status = dbGet(pscan->p3db, DBR_FLOAT, precPvt->pP3Limits,
&options, &nRequest, NULL);
}
if(!pscan->p4nv) {
nRequest = 1;
status = dbGet(pscan->p4db, DBR_FLOAT, precPvt->pP4Limits,
&options, &nRequest, NULL);
}

View File

@@ -452,6 +452,7 @@ CALLBACK *pCallback;
}
/* Dump the value to the destination field */
nRequest = 1;
recGblPutLinkValue(&(pcb->plinks[pcb->index]->lnk), (void *)pseq, DBR_DOUBLE, &(pcb->plinks[pcb->index]->dov), &nRequest);
if (myDouble != pcb->plinks[pcb->index]->dov)

View File

@@ -38,9 +38,14 @@
* dbGetField() to dbGet()
* .06 08-19-94 nda added Output data option of VAL or DOL
* .07 09-14-94 nda corrected bug that caused SCAN_DISABLE to lock up the record forever
* .08 02-01-95 nda added VERS and ODLY (output execution delay)
*
*
*/
#define VERSION 1.08
#include <vxWorks.h>
#include <types.h>
@@ -51,6 +56,7 @@
#include <tickLib.h>
#include <semLib.h>
#include <taskLib.h>
#include <wdLib.h>
#include <alarm.h>
#include <cvtTable.h>
@@ -141,6 +147,8 @@ struct {
***************************/
int waitRecDebug=0;
static unsigned long tickStart;
static void schedOutput();
static void reqOutput();
static void execOutput();
static int fetch_values();
static void monitor();
@@ -152,6 +160,7 @@ static void inputChanged();
struct cbStruct {
CALLBACK callback; /* code assumes CALLBACK is 1st in structure */
struct waitRecord *pwait; /* pointer to wait record which needs work done */
WDOG_ID wd_id; /* Watchdog used for delays */
IOSCANPVT ioscanpvt; /* used for IO_EVENT scanning */
CAMONITOR inpMonitor[12]; /* required structures for each input variable */
int procPending; /* flag to indicate record processing is pending */
@@ -184,6 +193,7 @@ static long init_record(pwait,pass)
short error_number;
if (pass==0) {
pwait->vers = VERSION;
pwait->inaa = calloc(1,sizeof(struct dbAddr));
pwait->inba = calloc(1,sizeof(struct dbAddr));
pwait->inca = calloc(1,sizeof(struct dbAddr));
@@ -241,6 +251,7 @@ static long init_record(pwait,pass)
callbackSetPriority(pwait->prio, &((struct cbStruct *)pwait->cbst)->callback);
pcbst = (struct cbStruct *)pwait->cbst;
pcbst->pwait = pwait;
pcbst->wd_id = wdCreate();
/* Set up monitors on input channels if scan type is IO Event */
@@ -292,6 +303,7 @@ static long process(pwait)
}
}
else { /* SIMULATION MODE */
nRequest = 1;
status = recGblGetLinkValue(&(pwait->siol),
(void *)pwait,DBR_DOUBLE,&(pwait->sval),&options,&nRequest);
if (status==0){
@@ -304,36 +316,36 @@ static long process(pwait)
/* decide whether to write Output PV */
switch(pwait->oopt) {
case REC_WAIT_OUT_OPT_EVERY:
callbackRequest(pwait->cbst);
schedOutput(pwait);
async = TRUE;
break;
case REC_WAIT_OUT_OPT_CHANGE:
if(fabs(pwait->oval - pwait->val) > pwait->mdel) {
callbackRequest(pwait->cbst);
schedOutput(pwait);
async = TRUE;
}
break;
case REC_WAIT_OUT_OPT_CHG_TO_ZERO:
if((pwait->oval != 0) && (pwait->val == 0)) {
callbackRequest(pwait->cbst);
schedOutput(pwait);
async = TRUE;
}
break;
case REC_WAIT_OUT_OPT_CHG_TO_NZERO:
if((pwait->oval == 0) && (pwait->val != 0)) {
callbackRequest(pwait->cbst);
schedOutput(pwait);
async = TRUE;
}
break;
case REC_WAIT_OUT_OPT_WHEN_ZERO:
if(!pwait->val) {
callbackRequest(pwait->cbst);
schedOutput(pwait);
async = TRUE;
}
break;
case REC_WAIT_OUT_OPT_WHEN_NZERO:
if(pwait->val) {
callbackRequest(pwait->cbst);
schedOutput(pwait);
async = TRUE;
}
break;
@@ -493,8 +505,12 @@ static long get_precision(paddr,precision)
struct waitRecord *pwait=(struct waitRecord *)paddr->precord;
*precision = pwait->prec;
if(paddr->pfield == (void *)&pwait->val) return(0);
recGblGetPrec(paddr,precision);
if(paddr->pfield == (void *)&pwait->val) {
*precision = pwait->prec;
}
else if(paddr->pfield == (void *)&pwait->odly) {
*precision = 3;
}
return(0);
}
@@ -627,7 +643,37 @@ struct waitRecord *pwait;
return(0);
}
/******************************************************************************
*
* The following functions schedule and/or request the execution of the output
* PV and output event based on the Output Execution Delay (ODLY).
* If .odly > 0, a watchdog is scheduled; if 0, reqOutput() is called immediately.
*
******************************************************************************/
static void schedOutput(pwait)
struct waitRecord *pwait;
{
struct cbStruct *pcbst = (struct cbStruct *)pwait->cbst;
int wdDelay;
if(pwait->odly > 0.0) {
/* Use the watch-dog as a delay mechanism */
wdDelay = pwait->odly * sysClkRateGet();
wdStart(pcbst->wd_id, wdDelay, (FUNCPTR)reqOutput, (int)(pwait));
} else {
reqOutput(pwait);
}
}
static void reqOutput(pwait)
struct waitRecord *pwait;
{
callbackRequest(pwait->cbst);
}
/******************************************************************************
*
* This is the code that is executed by the callback task to do the record
@@ -668,6 +714,12 @@ static double oldDold;
recGblFwdLink(pcbst->pwait);
pcbst->pwait->pact = FALSE;
/* If I/O Interrupt scanned, see if any inputs changed during delay */
if((pcbst->pwait->scan == SCAN_IO_EVENT) && (pcbst->procPending == 1)) {
scanOnce(pcbst->pwait);
}
return;
}

View File

@@ -375,6 +375,15 @@ struct message_buffer *recv
claim_ciu_action(mp, client);
break;
case IOC_READ_BUILD:
case IOC_BUILD:
/*
* starting with 3.12 CA ignores this
* protocol. No message is sent so that we avoid
* a broadcast storm.
*/
break;
default:
logMsg("CAS: bad msg detected\n",
NULL,

View File

@@ -43,7 +43,7 @@
* (added new arg to db_start_events())
*/
static char *sccsId = "@(#)camsgtask.c 1.13\t11/20/92";
static char *sccsId = "@(#) $Id$";
#include <vxWorks.h>
#include <ellLib.h>

View File

@@ -35,7 +35,7 @@
* .06 joh 031992 improved diagnostics
*/
static char *sccsId = "@(#)caserverio.c 1.18 5/6/94";
static char *sccsId = "@(#) $Id$";
#include <string.h>
#include <errno.h>

View File

@@ -44,7 +44,7 @@
* .12 joh 020494 identifies the client in client_stat
*/
static char *sccsId = "@(#)caservertask.c 1.22 5/6/94";
static char *sccsId = "@(#) $Id$";
#include <stdio.h>
#include <assert.h>
#include <unistd.h>
@@ -474,6 +474,8 @@ int client_stat(void)
FASTUNLOCK(&rsrv_free_addrq_lck);
}
caPrintAddrList (&beaconAddrList);
return ellCount(&clientQ);
}

View File

@@ -56,7 +56,7 @@
* pend which could lock up the cast server.
*/
static char *sccsId = "@(#)cast_server.c 1.24 5/6/94";
static char *sccsId = "@(#) $Id$";
#include <assert.h>
#include <string.h>

View File

@@ -30,7 +30,7 @@
*/
#define GLBLSOURCE
static char *sccsId = "@(#)globalsource.c 1.5\t7/28/92";
static char *sccsId = "@(#) $Id$";
#include <vxWorks.h>
#include <ellLib.h>

View File

@@ -33,7 +33,7 @@
* .00 joh 021192 better diagnostics
*/
static char *sccsId = "@(#)online_notify.c 1.14\t5/6/94";
static char *sccsId = "@(#) $Id$";
/*
* ansi includes
@@ -62,7 +62,6 @@ static char *sccsId = "@(#)online_notify.c 1.14\t5/6/94";
#include <envDefs.h>
#include "server.h"
#include <task_params.h>
#include <addrList.h>
/*
* RSRV_ONLINE_NOTIFY_TASK
@@ -72,7 +71,6 @@ static char *sccsId = "@(#)online_notify.c 1.14\t5/6/94";
*/
int rsrv_online_notify_task()
{
ELLLIST destAddr;
caAddrNode *pNode;
unsigned long delay;
unsigned long maxdelay;
@@ -143,17 +141,17 @@ int rsrv_online_notify_task()
bfill((char *)&msg, sizeof msg, 0);
msg.m_cmmd = htons(IOC_RSRV_IS_UP);
ellInit(&destAddr);
ellInit(&beaconAddrList);
/*
* load user and auto configured
* broadcast address list
*/
port = caFetchPortConfig(&EPICS_CA_REPEATER_PORT, CA_REPEATER_PORT);
caSetupBCastAddrList (&destAddr, sock, port);
caSetupBCastAddrList (&beaconAddrList, sock, port);
# ifdef DEBUG
caPrintAddrList(&destAddr);
caPrintAddrList(&beaconAddrList);
# endif
while(TRUE){
@@ -171,7 +169,7 @@ int rsrv_online_notify_task()
casDontAllowSearchReplies = FALSE;
}
pNode = (caAddrNode *) destAddr.node.next;
pNode = (caAddrNode *) beaconAddrList.node.next;
while(pNode){
msg.m_available =
pNode->srcAddr.inetAddr.sin_addr.s_addr;

View File

@@ -30,7 +30,7 @@
* .01 073093 Added task spawn args for 5.1 vxworks
*/
static char *sccsId = "@(#)rsrv_init.c 1.7\t7/28/92";
static char *sccsId = "@(#) $Id$";
#include <vxWorks.h>
#include <ellLib.h>
@@ -65,6 +65,7 @@ int rsrv_init()
ellInit(&rsrv_free_clientQ);
ellInit(&rsrv_free_addrq);
ellInit(&rsrv_free_eventq);
ellInit(&beaconAddrList);
prsrv_cast_client = NULL;
pCaBucket = NULL;

View File

@@ -43,7 +43,7 @@
#ifndef INCLserverh
#define INCLserverh
static char *serverhSccsId = "@(#)server.h 1.19 5/6/94";
static char *serverhSccsId = "@(#) $Id$";
#if defined(CAS_VERSION_GLOBAL) && 0
# define HDRVERSIONID(NAME,VERS) VERSIONID(NAME,VERS)
@@ -53,6 +53,8 @@ static char *serverhSccsId = "@(#)server.h 1.19 5/6/94";
typedef int SOCKET;
#define APIENTRY
#include <vxLib.h>
#include <ellLib.h>
#include <fast_lock.h>
@@ -67,6 +69,9 @@ typedef int SOCKET;
#include <asLib.h>
#include <asDbLib.h>
#include <socket.h>
#include <addrList.h>
struct message_buffer{
unsigned long stk;
unsigned long maxstk;
@@ -162,6 +167,7 @@ GLBLTYPE ELLLIST clientQ; /* locked by clientQlock */
GLBLTYPE ELLLIST rsrv_free_clientQ; /* locked by clientQlock */
GLBLTYPE ELLLIST rsrv_free_addrq;
GLBLTYPE ELLLIST rsrv_free_eventq;
GLBLTYPE ELLLIST beaconAddrList;
GLBLTYPE FAST_LOCK clientQlock;
GLBLTYPE FAST_LOCK rsrv_free_addrq_lck;
GLBLTYPE FAST_LOCK rsrv_free_eventq_lck;

View File

@@ -315,6 +315,7 @@ gen_state_prog_table()
encode_options()
{
int options;
extern int async_opt, debug_opt, reent_opt, conn_opt, newef_opt;
options = 0;
if (async_opt)

View File

@@ -452,6 +452,7 @@ char *line;
char *fname;
{
extern int line_num;
extern char *src_file;
line_num = atoi(line);
src_file = fname;

View File

@@ -176,6 +176,7 @@ Expr *ep;
reconcile_states()
{
extern int num_errors;
extern Expr *ss_list;
Expr *ssp, *sp, *sp1, tr;
for (ssp = ss_list; ssp != 0; ssp = ssp->next)

View File

@@ -2,37 +2,24 @@ EPICS = ../../../..
include Target.include
include $(EPICS)/config/CONFIG_BASE
CMPLR = OLD
USR_LDLIBS = -lAs -lca -lCom -lDb -lCom -lm -s
DEPLIBS_BASE = $(EPICS_BASE_LIB)
DEPLIBS = $(DEPLIBS_BASE)/libca.a\
$(DEPLIBS_BASE)/libDb.a \
$(DEPLIBS_BASE)/libCom.a \
$(DEPLIBS_BASE)/libAs.a
#USR_LDLIBS = -lm -s
USR_INCLUDES = -I$(OPENWIN)/include
USR_CFLAGS = -DXWINDOWS -UvxWorks
USR_LDLIBS = -lca -lCom -lm -s
DEPLIBS = $(EPICS_BASE_LIB)/libca.a $(EPICS_BASE_LIB)/libCom.a
SRCS.c = \
../bfRing.c ../ca_test.c \
../calcTest.c ../cmdClient.c ../extrDoc.c ../guiSubr.c \
../iocLogServer.c ../pprPlot.c ../racPrint.c ../recListProg.c \
../recordTest.c ../startCArepeater.c ../sydPlot.c
../ca_test.c \
../iocLogServer.c \
../startCArepeater.c
OBJS = \
bfRing.o ca_test.o calcTest.o \
cmdClient.o extrDoc.o guiSubr.o iocLogServer.o pprPlot.o racPrint.o \
recListProg.o recordTest.o startCArepeater.o sydPlot.o
ca_test.o \
iocLogServer.o \
startCArepeater.o
LIBOBJS = \
guiSubr.o pprPlot.o sydPlot.o
LIBNAME = libppr.a
PROD = \
bfRing ca_test calcTest cmdClient \
extrDoc iocLogServer racPrint recListProg recordTest startCArepeater
ca_test \
iocLogServer \
startCArepeater
include $(EPICS)/config/RULES.Unix

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