Compare commits

...

105 Commits

Author SHA1 Message Date
John Winans
e7e17f07af Probable race condition in PEP TX task. Moved the final transmission
byte assignment into the point where the busy list is locked.  This
is how the Xycom TX task has worked all along.  This change fixed
seems to have fixed an apparant race condition where the receive task
gets a response to a transmitted message BEFORE the TX task gets
it on the busy list.
1995-03-24 21:24:25 +00:00
Janet B. Anderson
8a23d381c4 Added define for USG 1995-03-24 15:29:08 +00:00
Janet B. Anderson
46b9bb6e6a Changed bcopy to memcpy and added include for string.h 1995-03-24 15:28:20 +00:00
Marty Kraimer
9ab85124d3 Allow pvnames to contain ; 1995-03-24 13:42:21 +00:00
Ned Arnold
b8f07e873d Version 1.15 always fills in RxCV, even if RxPV's are not valid. 1995-03-17 17:51:55 +00:00
John Winans
0cfd58942f Added waveform writing support 1995-03-10 16:55:40 +00:00
Jeff Hill
b75d3964d7 more ANSI C changes and fixed send call back lost problem 1995-03-08 17:44:46 +00:00
cvs2svn
b9c8cd50e0 This commit was manufactured by cvs2svn to create tag 'R3.12.0-beta9'. 1995-03-08 13:48:39 +00:00
Marty Kraimer
e7b8b42452 Make sure errInit is called before epicsPrintf or errPrintf execute 1995-03-08 13:48:38 +00:00
Marty Kraimer
4cc62a1fce Take errInit out of dbLoad 1995-03-08 13:45:36 +00:00
Jeff Hill
333c985399 added FTP script 1995-03-07 23:19:44 +00:00
Jeff Hill
f513681bc0 no zero length message under SOLARIS 1995-03-07 22:56:45 +00:00
Jeff Hill
ddb459d08a ANSI C changes 1995-03-07 22:47:51 +00:00
Marty Kraimer
6aa5ecfa0e Allow errInit to be called multiple times 1995-03-07 21:18:56 +00:00
Marty Kraimer
9bdea89b06 errInit must be called before errPrintf 1995-03-07 21:17:16 +00:00
John Winans
3c8b4bf8c0 added assertion to misc.c for dealing with the '\a' character problem. 1995-03-07 19:23:12 +00:00
Janet B. Anderson
a912205614 Put static on sub_it() definition. 1995-03-07 17:27:58 +00:00
Janet B. Anderson
3b094ac9ae Removed CMPLR=OLD line 1995-03-07 17:18:43 +00:00
Ned Arnold
13a7380a47 Bug fix. Didn't update PxRA arrays if no readback PV's were specified. 1995-03-07 15:29:45 +00:00
Jeff Hill
f1bc683bd4 ssert => epicsAssert 1995-03-07 01:25:09 +00:00
Jeff Hill
5d3ded4397 ssert to epicsAssert.h 1995-03-07 01:21:16 +00:00
Jeff Hill
4a5cb2a6e5 assert.h => epicsAssert.h 1995-03-07 01:20:33 +00:00
Jeff Hill
9300dded40 sizeof A => sizeof(A) 1995-03-06 22:45:29 +00:00
Jeff Hill
cb86cd03a7 Compiler warnings fixed 1995-03-06 22:44:57 +00:00
Jeff Hill
cee91cb578 badd status map btw TScurrentTimeStamp() => tsLocalTime () fixed 1995-03-06 22:44:10 +00:00
Jeff Hill
679e1b8a56 added misssing includes 1995-03-06 22:43:19 +00:00
Jeff Hill
f6d91b8876 added missing includes 1995-03-06 22:42:55 +00:00
Jeff Hill
a86c813415 this time for sure 1995-03-06 22:42:03 +00:00
Jeff Hill
be2491bc51 created 1995-03-06 22:38:42 +00:00
Jeff Hill
1634c70c06 added assert stuff 1995-03-06 22:37:55 +00:00
Jeff Hill
df876abf50 fixed warning messages 1995-03-06 22:37:04 +00:00
Jeff Hill
d5873d5e8a add missing LOCAL 1995-03-06 22:35:49 +00:00
Jeff Hill
b6c87ce10e fetch time in one place only 1995-03-06 22:34:05 +00:00
Jeff Hill
00d40d3e73 debug stmnts 1995-03-06 22:33:37 +00:00
Jeff Hill
410e6d9c00 doc and clened up mux io 1995-03-06 22:32:33 +00:00
Jeff Hill
03944c94e3 cleaned up mux io 1995-03-06 22:32:07 +00:00
Jeff Hill
b5f31b4b13 doc and cleaned up mux io 1995-03-06 22:31:47 +00:00
Jeff Hill
7bb7e8a884 missing includes 1995-03-06 22:16:33 +00:00
Jeff Hill
d153387372 fix cast causes excess CPU consumption 1995-03-06 22:16:04 +00:00
Jeff Hill
d4a4b23a55 fetch time in only one place 1995-03-06 22:14:55 +00:00
Jeff Hill
14a152ba72 doc 1995-03-06 22:09:12 +00:00
Jeff Hill
20b6539144 fetch time only once 1995-03-06 22:08:41 +00:00
Jeff Hill
93b6da9b3c clean up 1995-03-06 22:07:34 +00:00
Jeff Hill
542c0115c5 de-lint 1995-03-06 22:06:53 +00:00
Jeff Hill
15440b9b6c Fetch current time in only one place 1995-03-06 22:06:21 +00:00
Jeff Hill
4cb9699c03 init conts var that will later be initialized by CA. 1995-03-06 21:53:23 +00:00
Jeff Hill
6460c2fc1d fetch time only once 1995-03-06 21:51:52 +00:00
Jeff Hill
9b858b8a5f better build for test codes 1995-03-06 21:46:25 +00:00
Ned Arnold
ed30327d93 added positioner readback arrays, PxRA. CHANGED scanRecord.ascii !!! Post monitor on .val at each point 1995-03-06 17:29:48 +00:00
John Winans
35aba51c7f Removed declaration of yylval. It caused problems for everyone and should
be defined by the yacc used to build parse.y anyway.
1995-03-06 17:15:11 +00:00
John Winans
12fd359a3c Forced antelope to compile under strict ANSI w/o any warnings. 1995-03-06 17:00:16 +00:00
Marty Kraimer
e0b6ce3867 tsLocalTime on vxWorks now returns S_ts_OK for success just like unix 1995-03-03 14:53:02 +00:00
Marty Kraimer
c5fce1bd6c Added callbackRequestProcessCallback 1995-03-03 14:50:06 +00:00
Janet B. Anderson
2dfbf28c1b Changed to += syntax 1995-03-02 19:21:09 +00:00
Janet B. Anderson
32add4c78f Changed to += syntax 1995-03-02 19:12:00 +00:00
Janet B. Anderson
9ea5c86ab5 changed to += syntax 1995-03-02 19:10:48 +00:00
Janet B. Anderson
48efca8456 Changes to += syntax 1995-03-02 18:53:37 +00:00
Janet B. Anderson
382c496b24 Changed to += syntax 1995-03-02 18:52:09 +00:00
Janet B. Anderson
13173544a9 Ansi c changes 1995-03-02 18:49:26 +00:00
Janet B. Anderson
19bf9ec448 Fixed call to inet_ntoa and added ifdef for free on HP 1995-03-01 19:43:56 +00:00
Ned Arnold
a08656090e Fixed bug in detecting a transition. Put .OVAL = .VAL statement at end of process() 1995-02-28 21:35:00 +00:00
Johnny Tang
7b03f77e30 to be compatible with select prototype on hp. 1995-02-28 00:57:23 +00:00
Johnny Tang
80dbdf6814 Adde LOCAL to register_new_client func. 1995-02-28 00:56:15 +00:00
Johnny Tang
103bd7492a added RF_IO data structure. 1995-02-28 00:51:55 +00:00
Marty Kraimer
e55693525c If on vxWorks add #include <vxWorks.h> 1995-02-27 15:36:56 +00:00
Marty Kraimer
64bd8e03dc Fixed COS task so it works for > 1 link. 1995-02-27 15:35:38 +00:00
Marty Kraimer
49b77d096f Add include #include <vxWorks.h> 1995-02-27 15:33:12 +00:00
Marty Kraimer
ae720e75af add include vxWorks.h 1995-02-27 15:29:55 +00:00
Marty Kraimer
bca7b39ab6 Fixed problem with adding,removing monitors 1995-02-24 19:06:05 +00:00
Ned Arnold
3600bb9513 Improved recWaitCaTask and associated record code 1995-02-24 16:52:51 +00:00
Matt Needes
339d08b71d Fixed locking error. OOPS. 1995-02-23 21:45:03 +00:00
Matt Needes
687e1a2c16 Fixed a comment. 1995-02-23 21:43:34 +00:00
Matt Needes
a53bffb128 Fixed some inaccuracies 1995-02-22 18:55:24 +00:00
Janet B. Anderson
4a7c1b1715 Added comments. 1995-02-21 17:53:22 +00:00
Janet B. Anderson
e75c3729b8 Fixed comment on #endif stmt 1995-02-21 17:52:42 +00:00
Janet B. Anderson
7cc6c1993d Fixed comments on #endif statements 1995-02-21 17:51:22 +00:00
Ned Arnold
63a3b6827c Added .RTST flag to (optionally) return the positioners to the start position after a scan 1995-02-21 17:10:10 +00:00
Ned Arnold
b1f570f66d Added queuing of input monitors (if IO_INTR scanned) so no transitions would be missed 1995-02-21 15:32:15 +00:00
cvs2svn
239e6cfa2e This commit was manufactured by cvs2svn to create tag 'R3.12.0-beta8'. 1995-02-18 01:51:39 +00:00
Jeff Hill
e783ec0de9 added cinst to pformat decl so we match ansi C 1995-02-18 01:51:38 +00:00
Jeff Hill
23f970b821 const added to pformat declartion so we match ansi C 1995-02-18 01:50:07 +00:00
Jeff Hill
7ff04ea451 ansi C 1995-02-18 01:48:31 +00:00
Jeff Hill
fd9d79f445 epicsPrintf() changes 1995-02-18 01:41:12 +00:00
Marty Kraimer
a12e94cffb Forgot to remove mprintf.h 1995-02-17 20:59:30 +00:00
Marty Kraimer
d38eaf82cd Clean up errPrintf stuff 1995-02-17 20:55:09 +00:00
Marty Kraimer
b1382c3f19 All err init done by errInit 1995-02-17 20:50:21 +00:00
Jeff Hill
7eaeac2075 ansi C 1995-02-17 20:44:02 +00:00
Jeff Hill
96defa3afa use arch independent types 1995-02-17 20:43:32 +00:00
Jeff Hill
4b2f0c1d74 doc 1995-02-17 20:41:16 +00:00
Jeff Hill
53bfe9888a new model names 1995-02-17 20:40:27 +00:00
Jeff Hill
2c82e2976c use empty host name if os query fails 1995-02-17 20:10:46 +00:00
Jeff Hill
ea2efa0e47 fixed comment 1995-02-17 20:09:25 +00:00
Jeff Hill
bd5b7b61a0 Use empty user name if we cant query the os 1995-02-17 20:08:51 +00:00
Jeff Hill
6d2eafd2ca No ENV_PRIVATE_DATA alloc here and empty user name if query fails 1995-02-17 20:07:06 +00:00
Jeff Hill
67b4dc7064 added convert.c to the UNIX build 1995-02-17 20:05:23 +00:00
Janet B. Anderson
f3ad1f4d4e Initial version 1995-02-17 15:09:56 +00:00
Jeff Hill
0eb9331f88 NT changes 1995-02-16 22:35:44 +00:00
Jeff Hill
35b0e4aaba NT changes and (long) cast problem fixed 1995-02-16 22:34:06 +00:00
Ned Arnold
1ea57db276 changed name of caMonitor.c to recWaitCa.c 1995-02-16 20:36:59 +00:00
Ned Arnold
062e3d6d32 changed names of caMonitor stuff to recWaitCa stuff. Also added
individual flags for IO_INTR processing of inputs
1995-02-16 20:18:22 +00:00
Jim Kowalkowski
6937834dee Rewrote a suspicious looking loop. 1995-02-16 17:08:48 +00:00
Janet B. Anderson
f9793ec277 Initial version 1995-02-15 17:13:23 +00:00
John Winans
a93e2e8b26 Cleaned up some Hideos hacking and commented out the LANL debug code because
APS has had some add behaviour from GPIB lately and it is one of few things
that has changed WRT to it.
1995-02-14 22:33:01 +00:00
Marty Kraimer
d7275641dc Revert to previous version of dbpf 1995-02-14 19:57:38 +00:00
cvs2svn
9dc64d0063 This commit was manufactured by cvs2svn to create tag 'R3.12.0-beta7'. 1995-02-13 21:44:50 +00:00
106 changed files with 3313 additions and 2032 deletions

20
README
View File

@@ -10,11 +10,13 @@ Notes:
1. Before you can build or really use EPICS, you must set your
path properly:
set path = ( $path EPICS/base/tools EPICS/base/bin/HOST_ARCH )
set path = ( $path EPICS/base/tools EPICS/base/bin/HOST_ARCH \
EPICS/extensions/bin HOST_ARCH )
e.g.:
set path = ( $path /home/epics/base/tools /home/epics/base/bin/sun4 )
set path = ( $path /home/epics/base/tools /home/epics/base/bin/sun4 \
/home/epics/extensions/bin/sun4 )
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
@@ -130,11 +132,16 @@ define compile and link flags.
----------------------------------------------------------------------------
CONFIG_COMMON - Contains definitions describing the layout of base.
----------------------------------------------------------------------------
HRULES - Rules for traversing hierarchical directories.
CONFIG_BASE
CONFIG_EXTENSIONS - Defines what subdirectories get built by default under
base and extensions.
----------------------------------------------------------------------------
RULES.Vx - Rules for building with VxWorks makefiles.
----------------------------------------------------------------------------
RULES.Unix - Rules for building with Unix makefiles.
----------------------------------------------------------------------------
RULES_ARCHS
RULES_DIRS - Allows top-level type command syntax in low-level directories.
----------------------------------------------------------------------------
Table of files to change when building and adding architectures.
@@ -149,10 +156,13 @@ CONFIG_SITE.Unix.ARCH_CLASS m - c* -
CONFIG_SITE.Vx.ARCH_CLASS m c* - -
CONFIG.Unix.ARCH_CLASS - - c* -
CONFIG.Vx.ARCH_CLASS - c* - -
CONFIG_COMMON - - - -
HRULES - - - -
RULES.Vx - - - -
RULES.Unix - - - -
CONFIG_BASE - - - -
CONFIG_EXTENSIONS - - - -
CONFIG_COMMON - - - -
RULES_ARCHS - - - -
RULES_DIRS - - - -
m - Modify an existing file.
c - Create a new file.

29
README.solaris Normal file
View File

@@ -0,0 +1,29 @@
----------------------------------------------------------------------------
EPICS R3.12 Notes for Solaris 2.3
- By Andrew Johnson
----------------------------------------------------------------------------
Notes:
1. In order to build and use EPICS under Solaris 2, you must include
various directories in your path in the order given below, in addition
to those named in base/README. Some of these directories may already be
included in your path from your .login script or .cshrc file, so be
careful that the ordering is correct.
setenv PATH /usr/ucb:/usr/bin:/usr/ccs/bin:$PATH
2. It is not possible to compile the whole of EPICS under Solaris 2
using only the GNU gcc compiler - some routines which are needed (for
example quiet_nan()) have been unbundled by Sun and are provided with
their ANSI C compiler. The path to the Sun compiler is explicitly set
using the SPARCWORKS definition in the file CONFIG_SITE.Unix.solaris
3. EPICS must be compiled and linked using the UCB compatability
libraries. The definitions UCB_LIB and UCB_INCLUDE are used here to
refer to these libraries and their header files, and the tools provided
within /usr/ucb must be used in preference to the System V ones, hence
the above path ordering.
--
anj@mail.ast.cam.ac.uk

View File

@@ -52,6 +52,10 @@ DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000).
* .01 10-15-93 mrk Initial Implementation
*/
#ifdef vxWorks
#include <vxWorks.h>
#include <taskLib.h>
#endif
#include <dbDefs.h>
#include <asLib.h>
#include <string.h>
@@ -60,9 +64,6 @@ DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000).
#include <stdio.h>
#include <gpHash.h>
#include <freeList.h>
#ifdef vxWorks
#include <taskLib.h>
#endif
/*Declare storage for Global Variables */
ASBASE *pasbase=NULL;

View File

@@ -1,6 +1,6 @@
integer [0-9]
name [a-zA-Z0-9_\.]
pvname [a-zA-Z0-9_:\.\[\]<>]
pvname [a-zA-Z0-9_:\.\[\]<>;]
string [a-zA-Z0-9_\,\./\*#\[\]%: ;!|\'\-&\(\)@\?\+<>=\$]
%{

View File

@@ -19,9 +19,27 @@ $! Arguments : optional source file name
$!
$! Created 16-NOV-1993 Mark L. Rivers
$! 05-MAY-1994 Jeff O. Hill Updated for EPICS 3.12
$! 07-MAR-1995 Jeff O. Hill Added FTP script
$!
$!========================================================================
$!
$! Example FTP script moves sources from UNIX to VMS
$! (remove "$!" comment delimeters)
$!
$! user XXXXXXX
$! cd [.ca]
$! prompt
$! lcd ~/epics/base/src/ca
$! mput *.c
$! mput *.h
$! put BUILD_VMS.COM
$! lcd ../libCom
$! mput *.c
$! mput *.h
$! lcd ../../include
$! mput *.h
$!========================================================================
$!
$ define /nolog sys multinet_root:[multinet.include.sys]
$ define /nolog vms multinet_root:[multinet.include.vms]
$ define /nolog net multinet_root:[multinet.include.net]
@@ -52,10 +70,9 @@ IF_DEPEN, -
VMS_DEPEN, -
ELLLIB, -
BUCKETLIB, -
NEXTFIELDSUBR, -
ENVSUBR, -
TSSUBR, -
GENSUBR, -
NEXTFIELDSUBR, -
CATIME, -
ACCTST
$ endif
@@ -76,10 +93,9 @@ IF_DEPEN, -
VMS_DEPEN, -
BSD_DEPEN, -
BUCKETLIB, -
NEXTFIELDSUBR, -
TSSUBR, -
ENVSUBR, -
GENSUBR, -
NEXTFIELDSUBR, -
ELLLIB
$! Link the test programs
$ call link acctst

View File

@@ -2,7 +2,6 @@ EPICS = ../../../..
include Target.include
include $(EPICS)/config/CONFIG_BASE
USR_CFLAGS = -DACCESS_SECURITY -D_NO_PROTO
USR_LDLIBS = -lca -lCom -lm
USR_LDFLAGS = -L.
@@ -15,14 +14,15 @@ SRCS.c = \
../iocinf.c ../access.c ../test_event.c ../service.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 ../catime.c
../posix_depen.c ../caRepeater.c ../acctst.c ../catime.c \
../convert.c
OBJS = caRepeater.o
LIBOBJS = \
iocinf.o access.o test_event.o service.o flow_control.o repeater.o \
conn.o syncgrp.o if_depen.o netdb_depen.o \
bsd_depen.o posix_depen.o
bsd_depen.o posix_depen.o convert.o
LIBNAME = libca.a
@@ -31,12 +31,14 @@ PROD = caRepeater
include $(EPICS)/config/RULES.Unix
acctst: acctst.o $(DEPLIBS_BASE)/libCom.a libca.a
acctst: acctst.o $(LIBOBJS) $(DEPLIBS_BASE)/libCom.a
$(LINK.c) -o $@ $< $(LIBOBJS) $(DEPLIBS_BASE)/libCom.a
acctst.o: ../acctst.c
$(COMPILE.c) $<
catime: catime.o $(DEPLIBS_BASE)/libCom.a libca.a
catime: catime.o $(LIBOBJS) $(DEPLIBS_BASE)/libCom.a
$(LINK.c) -o $@ $< $(LIBOBJS) $(DEPLIBS_BASE)/libCom.a
catime.o: ../catime.c
$(COMPILE.c) $<

View File

@@ -2,12 +2,11 @@ EPICS = ../../../..
include Target.include
include $(EPICS)/config/CONFIG_BASE
USR_CFLAGS = -DACCESS_SECURITY -D_NO_PROTO
SRCS.c = \
../iocinf.c ../access.c ../test_event.c ../service.c \
../flow_control.c ../repeater.c ../conn.c ../syncgrp.c \
../if_depen.c ../bsd_depen.c ../vxWorks_depen.c ../acctst.c
../if_depen.c ../bsd_depen.c ../vxWorks_depen.c ../acctst.c \
../catime.c
OBJS = \
iocinf.o access.o test_event.o service.o flow_control.o \
@@ -20,3 +19,10 @@ include $(EPICS)/config/RULES.Vx
caLib: $(OBJS)
$(RM) $@
$(LINK.c) $@ $(OBJS) $(LDLIBS)
acctst.o: ../acctst.c
$(COMPILE.c) $<
catime.o: ../catime.c
$(COMPILE.c) $<

View File

@@ -134,6 +134,7 @@ static char *sccsId = "@(#) $Id$";
#include "iocinf.h"
#include "net_convert.h"
#include <epicsPrint.h>
#include <stdarg.h> /* for VMS old CC include order madness */
@@ -248,12 +249,14 @@ void *pext
unsigned bytesAvailable;
unsigned actualextsize;
unsigned extsize;
unsigned msgsize;
unsigned bytesSent;
msg = *pmsg;
actualextsize = pmsg->m_postsize;
extsize = CA_MESSAGE_ALIGN(pmsg->m_postsize);
msg.m_postsize = htons((ca_uint16_t)extsize);
msgsize = extsize+sizeof(msg);
LOCK;
@@ -270,13 +273,13 @@ void *pext
* o Does not allow for messages larger than the
* ring buffer size.
*/
if(extsize+sizeof(msg)>piiu->send.max_msg){
if(msgsize>piiu->send.max_msg){
return ECA_TOLARGE;
}
bytesAvailable = cacRingBufferWriteSize(&piiu->send, FALSE);
if (bytesAvailable<extsize+sizeof(msg)) {
if (bytesAvailable<msgsize) {
/*
* try to send first so that we avoid the
* overhead of select() in high throughput
@@ -286,7 +289,7 @@ void *pext
bytesAvailable =
cacRingBufferWriteSize(&piiu->send, FALSE);
while(bytesAvailable<extsize+sizeof(msg)){
while(TRUE){
struct timeval itimeout;
/*
@@ -301,16 +304,35 @@ void *pext
UNLOCK;
LD_CA_TIME (SELECT_POLL, &itimeout);
cac_mux_io(&itimeout);
cac_mux_io (&itimeout);
LOCK;
bytesAvailable = cacRingBufferWriteSize(
&piiu->send,
FALSE);
if(bytesAvailable>=extsize+sizeof(msg)){
/*
* record the time if we end up blocking so that
* we can time out
*/
if (bytesAvailable>=extsize+sizeof(msg)) {
# if DEBUG
If (piiu->sendPending) {
printf ("-Unblocked-\n");
}
# endif /* DEBUG */
piiu->sendPending = FALSE;
break;
}
else {
if (!piiu->sendPending) {
# if DEBUG
printf ("-Blocked-\n");
# endif /* DEBUG */
piiu->timeAtSendBlock = ca_static->currentTime;
piiu->sendPending = TRUE;
}
}
}
}
@@ -402,79 +424,6 @@ struct extmsg **ppMsg
return ECA_NORMAL;
}
/*
*
* cac_alloc_msg()
*
* return a pointer to reserved message buffer space or
* nill if the message will not fit
*
* LOCK should be on
*
*/
#if 0
LOCAL int cac_alloc_msg(
struct ioc_in_use *piiu,
unsigned extsize,
struct extmsg **ppMsg
)
{
unsigned msgsize;
unsigned long bytesAvailable;
struct extmsg *pmsg;
msgsize = sizeof(struct extmsg)+extsize;
/*
* fail if max message size exceeded
*/
if(msgsize>=piiu->send.max_msg){
return ECA_TOLARGE;
}
bytesAvailable = cacRingBufferWriteSize(&piiu->send, TRUE);
if (bytesAvailable<msgsize) {
/*
* try to send first so that we avoid the
* overhead of select() in high throughput
* situations
*/
(*piiu->sendBytes)(piiu);
bytesAvailable = cacRingBufferWriteSize(
&piiu->send,
TRUE);
while (bytesAvailable<msgsize) {
struct timeval itimeout;
/*
* if connection drops request
* cant be completed
*/
if(!piiu->conn_up){
return ECA_BADCHID;
}
UNLOCK;
LD_CA_TIME (SELECT_POLL, &itimeout);
cac_mux_io(&itimeout);
LOCK;
bytesAvailable = cacRingBufferWriteSize(
&piiu->send,
TRUE);
}
}
pmsg = (struct extmsg *) &piiu->send.buf[piiu->send.wtix];
pmsg->m_postsize = extsize;
*ppMsg = pmsg;
return ECA_NORMAL;
}
#endif
/*
* cac_add_msg ()
@@ -548,6 +497,8 @@ int ca_os_independent_init (void)
return ECA_ALLOCMEM;
}
cac_gettimeval (&ca_static->currentTime);
/* init sync group facility */
ca_sg_init();
@@ -559,7 +510,7 @@ int ca_os_independent_init (void)
sec = (unsigned) CA_RECAST_DELAY;
ca_static->ca_conn_retry_delay.tv_sec = sec;
ca_static->ca_conn_retry_delay.tv_usec =
(long) (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);
@@ -1109,7 +1060,7 @@ int APIENTRY ca_search_and_connect
sec = (int) CA_RECAST_DELAY;
ca_static->ca_conn_retry_delay.tv_sec = sec;
ca_static->ca_conn_retry_delay.tv_usec =
(long) (CA_RECAST_DELAY-sec)*USEC_PER_SEC;
(long) ((CA_RECAST_DELAY-sec)*USEC_PER_SEC);
UNLOCK;
@@ -2230,6 +2181,7 @@ int ca_request_event(evid monix)
htonf(&n_delta, &msg.m_info.m_lval);
htonf(&tmo, &msg.m_info.m_toval);
msg.m_info.m_mask = htons(monix->mask);
msg.m_info.m_pad = 0; /* allow future use */
status = cac_push_msg(piiu, &msg.m_header, &msg.m_info);
@@ -2670,7 +2622,6 @@ void clearChannelResources(unsigned id)
int APIENTRY ca_pend(ca_real timeout, int early)
{
struct timeval beg_time;
struct timeval cur_time;
ca_real delay;
INITCHK;
@@ -2689,28 +2640,32 @@ int APIENTRY ca_pend(ca_real timeout, int early)
* Also takes care of outstanding recvs
* for single threaded clients
*/
#if 0
ca_flush_io();
#endif
if(pndrecvcnt<1 && early){
return ECA_NORMAL;
}
cac_gettimeval(&beg_time);
/*
* the current time set iderectly within ca_flush_io()
* above.
*/
beg_time = ca_static->currentTime;
delay = 0.0;
while(TRUE){
ca_real remaining;
struct timeval tmo;
if(pndrecvcnt<1 && early)
if (pndrecvcnt<1 && early) {
return ECA_NORMAL;
}
if(timeout == 0.0){
remaining = SELECT_POLL;
}
else{
cac_gettimeval (&cur_time);
delay = cac_time_diff (&cur_time, &beg_time);
remaining = timeout-delay;
if(remaining<=0.0){
if(early){
@@ -2722,12 +2677,20 @@ int APIENTRY ca_pend(ca_real timeout, int early)
/*
* Allow for CA background labor
*/
remaining = (long) min(SELECT_POLL, remaining);
remaining = min(SELECT_POLL, remaining);
}
tmo.tv_sec = (long) remaining;
tmo.tv_usec = (long) (remaining-tmo.tv_sec)*USEC_PER_SEC;
tmo.tv_usec = (long) ((remaining-tmo.tv_sec)*USEC_PER_SEC);
cac_block_for_io_completion(&tmo);
/*
* the current time set within cac_block_for_io_completion()
* above.
*/
if (timeout != 0.0) {
delay = cac_time_diff (&ca_static->currentTime, &beg_time);
}
}
}
@@ -2739,13 +2702,13 @@ ca_real cac_time_diff (ca_time *pTVA, ca_time *pTVB)
{
ca_real delay;
delay = pTVA->tv_sec - pTVB->tv_sec;
if(pTVA->tv_usec>pTVB->tv_usec){
delay = pTVA->tv_sec - pTVB->tv_sec;
delay += (pTVA->tv_usec - pTVB->tv_usec) /
(ca_real)(USEC_PER_SEC);
}
else{
delay -= 1.0;
delay = pTVA->tv_sec - pTVB->tv_sec - 1L;
delay += (USEC_PER_SEC - pTVB->tv_usec + pTVA->tv_usec) /
(ca_real)(USEC_PER_SEC);
}
@@ -3384,7 +3347,7 @@ int ca_channel_status(int tid)
* ca_replace_printf_handler ()
*/
int APIENTRY ca_replace_printf_handler (
int (*ca_printf_func)(char *pformat, va_list args)
int (*ca_printf_func)(const char *pformat, va_list args)
)
{
if (ca_printf_func) {
@@ -3406,13 +3369,13 @@ int (*ca_printf_func)(char *pformat, va_list args)
*/
int ca_printf(char *pformat, ...)
{
int (*ca_printf_func)(char *pformat, va_list args);
int (*ca_printf_func)(const char *pformat, va_list args);
va_list theArgs;
int status;
va_start(theArgs, pformat);
ca_printf_func = ca_default_printf;
ca_printf_func = epicsVprintf;
if (ca_static) {
if (ca_static->ca_printf_func) {
ca_printf_func = ca_static->ca_printf_func;
@@ -3426,21 +3389,3 @@ int ca_printf(char *pformat, ...)
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

@@ -9,12 +9,17 @@ static char *sccsId = "@(#) $Id$";
#include <LIB$ROUTINES.H>
#endif
/*
* ANSI
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <math.h>
#include <float.h>
#include "os_depen.h"
#include <epicsAssert.h>
#include <cadef.h>
#define EVENT_ROUTINE null_event
@@ -219,22 +224,22 @@ int doacctst(char *pname)
double dval = 3.3;
float fval = -8893.3;
double dret;
float fret;
double dret = DBL_MAX;
float fret = FLT_MAX;
status = ca_put(DBR_DOUBLE, chix1, &dval);
SEVCHK(status, NULL);
status = ca_get(DBR_DOUBLE, chix1, &dret);
SEVCHK(status, NULL);
ca_pend_io(30.0);
assert(dval - dret < .000001);
assert( fabs(dval-dret) < DBL_EPSILON*4);
status = ca_put(DBR_FLOAT, chix1, &fval);
SEVCHK(status, NULL);
status = ca_get(DBR_FLOAT, chix1, &fret);
SEVCHK(status, NULL);
ca_pend_io(30.0);
assert(fval - fret < .0001);
assert( fabs(fval-fret) < FLT_EPSILON*4);
}
/*
@@ -557,8 +562,8 @@ void conn_cb(struct event_handler_args args)
void test_sync_groups(chid chix)
{
int status;
CA_SYNC_GID gid1;
CA_SYNC_GID gid2;
CA_SYNC_GID gid1=0;
CA_SYNC_GID gid2=0;
printf("Performing sync group test...");
fflush(stdout);

View File

@@ -42,6 +42,11 @@
*/
int cac_select_io(struct timeval *ptimeout, int flags)
{
/*
* Use auto timeout so there is no chance of
* recursive reuse of ptimeout
*/
struct timeval autoTimeOut = *ptimeout;
long status;
IIU *piiu;
unsigned long freespace;
@@ -86,39 +91,59 @@ int cac_select_io(struct timeval *ptimeout, int flags)
}
if (flags&CA_DO_SENDS) {
if (cacRingBufferReadSize(&piiu->send, FALSE)>0) {
if (cacRingBufferReadSize(&piiu->send, FALSE)>0) {
maxfd = max (maxfd,piiu->sock_chan);
FD_SET (piiu->sock_chan, &pfdi->writeMask);
}
FD_SET (piiu->sock_chan, &pfdi->writeMask);
}
}
}
UNLOCK;
#if 0
printf( "max fd=%d tv_usec=%d tv_sec=%d\n",
maxfd,
ptimeout->tv_usec,
ptimeout->tv_sec);
#endif
# if 0
if (maxfd==0) {
printf( "max fd=%d tv_usec=%d tv_sec=%d\n",
maxfd,
ptimeout->tv_usec,
ptimeout->tv_sec);
}
# endif
#if defined(vxWorks) && 0
if(client_lock->recurse>0){
ca_printf("lock is on and we are going to sleep %d!",
client_lock->recurse);
taskSuspend(0);
}
#endif
# if 0 && defined(vxWorks)
if(client_lock->recurse>0){
ca_printf("lock is on and we are going to sleep %d!",
client_lock->recurse);
taskSuspend(0);
}
# endif
status = select(
maxfd+1,
&pfdi->readMask,
&pfdi->writeMask,
NULL,
ptimeout);
# if defined(__hpux)
status = select(
maxfd+1,
(int *)&pfdi->readMask,
(int *)&pfdi->writeMask,
(int *)NULL,
&autoTimeOut);
# else
status = select(
maxfd+1,
&pfdi->readMask,
&pfdi->writeMask,
NULL,
&autoTimeOut);
# endif
# if 0
if(status<0){
printf("leaving select stat=%d - %s \n",
status, strerror(MYERRNO) );
}
else if (status==0) {
printf("tmo in select\n");
}
# endif
cac_gettimeval (&ca_static->currentTime);
#if 0
printf("leaving select stat=%d errno=%d \n", status, MYERRNO);
#endif
if (status<0) {
if (MYERRNO == EINTR) {
}
@@ -144,13 +169,13 @@ printf("leaving select stat=%d errno=%d \n", status, MYERRNO);
continue;
}
if (FD_ISSET(piiu->sock_chan,&pfdi->writeMask)) {
(*piiu->sendBytes)(piiu);
}
if (FD_ISSET(piiu->sock_chan,&pfdi->readMask)) {
(*piiu->recvBytes)(piiu);
}
if (FD_ISSET(piiu->sock_chan,&pfdi->writeMask)) {
(*piiu->sendBytes)(piiu);
}
}
}

View File

@@ -19,11 +19,11 @@
*
*/
#include <assert.h>
#include <stdio.h>
#include <iocinf.h>
main()
{
ca_repeater();
assert(0);
ca_repeater ();
assert (0);
return (0);
}

View File

@@ -11,10 +11,10 @@
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include <cadef.h>
#include <epicsAssert.h>
#include <cadef.h>
#ifndef LOCAL
#define LOCAL static
@@ -36,7 +36,7 @@
#define NELEMENTS(A) (sizeof (A) / sizeof ((A) [0]))
#endif
#define ITERATION_COUNT 10000
#define ITERATION_COUNT 1000
#define WAIT_FOR_ACK
@@ -50,9 +50,9 @@ typedef struct testItem {
ti itemList[ITERATION_COUNT];
int catime(char *channelName);
int catime (char *channelName);
typedef void tf (ti *pItems, unsigned iterations);
typedef void tf (ti *pItems, unsigned iterations, unsigned *pInlineIter);
LOCAL void test (
ti *pItems,
@@ -95,8 +95,7 @@ int main(int argc, char **argv)
*/
int catime (char *channelName)
{
long status;
long i,j;
long i;
unsigned strsize;
SEVCHK (ca_task_initialize(),"Unable to initialize");
@@ -144,6 +143,8 @@ int catime (char *channelName)
printf ("free test\n");
timeIt (test_free, itemList, NELEMENTS(itemList));
SEVCHK (ca_task_exit (), "Unable to free resources at exit");
return OK;
}
@@ -158,11 +159,11 @@ LOCAL void test (
)
{
printf ("\tasync put test\n");
timeIt(test_put, pItems, iterations);
timeIt (test_put, pItems, iterations);
printf ("\tasync get test\n");
timeIt(test_get, pItems, iterations);
timeIt (test_get, pItems, iterations);
printf ("\tsynch get test\n");
timeIt(test_wait, pItems, iterations);
timeIt (test_wait, pItems, iterations);
}
@@ -179,14 +180,15 @@ void timeIt(
TS_STAMP start_time;
double delay;
int status;
unsigned inlineIter;
status = tsLocalTime(&start_time);
assert (status == S_ts_OK);
(*pfunc) (pItems, iterations);
(*pfunc) (pItems, iterations, &inlineIter);
status = tsLocalTime(&end_time);
assert (status == S_ts_OK);
TsDiffAsDouble(&delay,&end_time,&start_time);
printf ("Elapsed Per Item = %f\n", delay/iterations);
printf ("Elapsed Per Item = %f\n", delay/(iterations*inlineIter));
}
@@ -195,24 +197,23 @@ void timeIt(
*/
LOCAL void test_search(
ti *pItems,
unsigned iterations
unsigned iterations,
unsigned *pInlineIter
)
{
int i;
ti *pi;
int status;
chid chan;
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;
for (pi=pItems; pi<&pItems[iterations]; pi++) {
status = ca_search (
pi->name,
&pi->chix);
SEVCHK (status, NULL);
}
status = ca_pend_io(0.0);
SEVCHK (status, NULL);
*pInlineIter = 1;
}
@@ -221,29 +222,18 @@ unsigned iterations
*/
LOCAL void test_free(
ti *pItems,
unsigned iterations
unsigned iterations,
unsigned *pInlineIter
)
{
int i;
ti *pi;
int status;
dbr_int_t val;
status = ca_clear_channel (pItems[0].chix);
SEVCHK (status, NULL);
#if 0
#ifdef WAIT_FOR_ACK
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
for (pi=pItems; pi<&pItems[iterations]; pi++) {
status = ca_clear_channel (pi->chix);
SEVCHK (status, NULL);
}
*pInlineIter = 1;
}
@@ -252,19 +242,74 @@ unsigned iterations
*/
LOCAL void test_put(
ti *pItems,
unsigned iterations
unsigned iterations,
unsigned *pInlineIter
)
{
int i;
ti *pi;
int status;
dbr_int_t val;
for (i=1; i<iterations; i++) {
for (pi=pItems; pi<&pItems[iterations]; pi++) {
status = ca_array_put(
pItems[i].type,
pItems[i].count,
pItems[i].chix,
&pItems[i].val);
pi->type,
pi->count,
pi->chix,
&pi->val);
SEVCHK (status, NULL);
status = ca_array_put(
pi->type,
pi->count,
pi->chix,
&pi->val);
SEVCHK (status, NULL);
status = ca_array_put(
pi->type,
pi->count,
pi->chix,
&pi->val);
SEVCHK (status, NULL);
status = ca_array_put(
pi->type,
pi->count,
pi->chix,
&pi->val);
SEVCHK (status, NULL);
status = ca_array_put(
pi->type,
pi->count,
pi->chix,
&pi->val);
SEVCHK (status, NULL);
status = ca_array_put(
pi->type,
pi->count,
pi->chix,
&pi->val);
SEVCHK (status, NULL);
status = ca_array_put(
pi->type,
pi->count,
pi->chix,
&pi->val);
SEVCHK (status, NULL);
status = ca_array_put(
pi->type,
pi->count,
pi->chix,
&pi->val);
SEVCHK (status, NULL);
status = ca_array_put(
pi->type,
pi->count,
pi->chix,
&pi->val);
SEVCHK (status, NULL);
status = ca_array_put(
pi->type,
pi->count,
pi->chix,
&pi->val);
SEVCHK (status, NULL);
}
#ifdef WAIT_FOR_ACK
@@ -280,6 +325,8 @@ unsigned iterations
SEVCHK (status, NULL);
status = ca_flush_io();
SEVCHK (status, NULL);
*pInlineIter = 10;
}
@@ -288,22 +335,79 @@ unsigned iterations
*/
LOCAL void test_get(
ti *pItems,
unsigned iterations
unsigned iterations,
unsigned *pInlineIter
)
{
int i;
ti *pi;
int status;
for (i=0; i<iterations; i++) {
for (pi=pItems; pi<&pItems[iterations]; pi++) {
status = ca_array_get(
pItems[i].type,
pItems[i].count,
pItems[i].chix,
&pItems[i].val);
pi->type,
pi->count,
pi->chix,
&pi->val);
SEVCHK (status, NULL);
status = ca_array_get(
pi->type,
pi->count,
pi->chix,
&pi->val);
SEVCHK (status, NULL);
status = ca_array_get(
pi->type,
pi->count,
pi->chix,
&pi->val);
SEVCHK (status, NULL);
status = ca_array_get(
pi->type,
pi->count,
pi->chix,
&pi->val);
SEVCHK (status, NULL);
status = ca_array_get(
pi->type,
pi->count,
pi->chix,
&pi->val);
SEVCHK (status, NULL);
status = ca_array_get(
pi->type,
pi->count,
pi->chix,
&pi->val);
SEVCHK (status, NULL);
status = ca_array_get(
pi->type,
pi->count,
pi->chix,
&pi->val);
SEVCHK (status, NULL);
status = ca_array_get(
pi->type,
pi->count,
pi->chix,
&pi->val);
SEVCHK (status, NULL);
status = ca_array_get(
pi->type,
pi->count,
pi->chix,
&pi->val);
SEVCHK (status, NULL);
status = ca_array_get(
pi->type,
pi->count,
pi->chix,
&pi->val);
SEVCHK (status, NULL);
}
status = ca_pend_io(100.0);
SEVCHK (status, NULL);
*pInlineIter = 10;
}
@@ -313,21 +417,24 @@ unsigned iterations
*/
LOCAL void test_wait (
ti *pItems,
unsigned iterations
unsigned iterations,
unsigned *pInlineIter
)
{
int i;
ti *pi;
int status;
for (i=1; i<iterations; i++) {
for (pi=pItems; pi<&pItems[iterations]; pi++) {
status = ca_array_get(
pItems[i].type,
pItems[i].count,
pItems[i].chix,
&pItems[i].val);
pi->type,
pi->count,
pi->chix,
&pi->val);
SEVCHK (status, NULL);
status = ca_pend_io(100.0);
SEVCHK (status, NULL);
}
*pInlineIter = 1;
}

View File

@@ -66,7 +66,6 @@ LOCAL void retrySearchRequest(int silent);
void manage_conn(int silent)
{
IIU *piiu;
ca_time current;
ca_real delay;
long idelay;
@@ -79,8 +78,6 @@ void manage_conn(int silent)
ca_static->ca_manage_conn_active = TRUE;
cac_gettimeval(&current);
/*
* issue connection heartbeat
* (if we dont see a beacon)
@@ -100,7 +97,7 @@ void manage_conn(int silent)
*/
if (piiu->sendPending) {
delay = cac_time_diff (
&current,
&ca_static->currentTime,
&piiu->timeAtSendBlock);
if (delay>ca_static->ca_connectTMO) {
TAG_CONN_DOWN(piiu);
@@ -117,15 +114,15 @@ void manage_conn(int silent)
int rtmo;
delay = cac_time_diff (
&current,
&ca_static->currentTime,
&piiu->timeAtEchoRequest);
stmo = delay > CA_RETRY_PERIOD;
delay = cac_time_diff (
&current,
&ca_static->currentTime,
&piiu->timeAtLastRecv);
rtmo = delay > CA_RETRY_PERIOD;
if(stmo && rtmo && !piiu->sendPending){
piiu->timeAtEchoRequest = current;
piiu->timeAtEchoRequest = ca_static->currentTime;
noop_msg(piiu);
}
continue;
@@ -133,7 +130,7 @@ void manage_conn(int silent)
if(piiu->echoPending){
delay = cac_time_diff (
&current,
&ca_static->currentTime,
&piiu->timeAtEchoRequest);
if (delay > CA_ECHO_TIMEOUT) {
/*
@@ -144,10 +141,10 @@ void manage_conn(int silent)
}
else{
delay = cac_time_diff (
&current,
&ca_static->currentTime,
&piiu->timeAtLastRecv);
if (delay>ca_static->ca_connectTMO) {
echo_request(piiu, &current);
echo_request(piiu, &ca_static->currentTime);
}
}
@@ -159,10 +156,10 @@ void manage_conn(int silent)
*/
if (!ca_static->ca_repeater_contacted) {
delay = cac_time_diff (
&current,
&ca_static->currentTime,
&ca_static->ca_last_repeater_try);
if (delay > REPEATER_TRY_PERIOD) {
ca_static->ca_last_repeater_try = current;
ca_static->ca_last_repeater_try = ca_static->currentTime;
notify_ca_repeater();
}
}
@@ -181,13 +178,13 @@ void manage_conn(int silent)
if(ca_static->ca_conn_next_retry.tv_sec == CA_CURRENT_TIME.tv_sec &&
ca_static->ca_conn_next_retry.tv_usec == CA_CURRENT_TIME.tv_usec){
ca_static->ca_conn_next_retry = current;
ca_static->ca_conn_next_retry = ca_static->currentTime;
LOGRETRYINTERVAL
}
delay = cac_time_diff (
&ca_static->ca_conn_next_retry,
&current);
&ca_static->currentTime);
if (delay > 0.0) {
ca_static->ca_manage_conn_active = FALSE;
@@ -220,7 +217,7 @@ void manage_conn(int silent)
(long) ((delay-idelay)*USEC_PER_SEC);
ca_static->ca_conn_next_retry =
cac_time_sum (
&current,
&ca_static->currentTime,
&ca_static->ca_conn_retry_delay);
LOGRETRYINTERVAL
@@ -353,7 +350,6 @@ void mark_server_available(struct in_addr *pnet_addr)
{
chid chan;
ca_real currentPeriod;
ca_time currentTime;
bhe *pBHE;
unsigned port;
int netChange = FALSE;
@@ -368,8 +364,6 @@ void mark_server_available(struct in_addr *pnet_addr)
return;
}
cac_gettimeval(&currentTime);
LOCK;
/*
* look for it in the hash table
@@ -386,14 +380,14 @@ void mark_server_available(struct in_addr *pnet_addr)
* update time stamp and average period
*/
currentPeriod = cac_time_diff (
&currentTime,
&ca_static->currentTime,
&pBHE->timeStamp);
/*
* update the average
*/
pBHE->averagePeriod += currentPeriod;
pBHE->averagePeriod /= 2.0;
pBHE->timeStamp = currentTime;
pBHE->timeStamp = ca_static->currentTime;
if ((currentPeriod/4.0)>=pBHE->averagePeriod) {
#ifdef DEBUG
@@ -417,7 +411,7 @@ void mark_server_available(struct in_addr *pnet_addr)
netChange = TRUE;
}
if(pBHE->piiu){
pBHE->piiu->timeAtLastRecv = currentTime;
pBHE->piiu->timeAtLastRecv = ca_static->currentTime;
}
if(!netChange){
UNLOCK;
@@ -469,8 +463,8 @@ void mark_server_available(struct in_addr *pnet_addr)
delay += CA_RECAST_DELAY;
idelay = (long) delay;
ca_delay.tv_sec = idelay;
ca_delay.tv_usec = (long) (delay-idelay) * USEC_PER_SEC;
next = cac_time_sum(&currentTime, &ca_delay);
ca_delay.tv_usec = (long) ((delay-idelay) * USEC_PER_SEC);
next = cac_time_sum(&ca_static->currentTime, &ca_delay);
diff = cac_time_diff(
&ca_static->ca_conn_next_retry,

View File

@@ -1592,7 +1592,7 @@ void ntohf(float *pNet, float *pHost)
#endif /*CA_FLOAT_MIT*/
#if !defined(CA_FLOAT_MIT)
#if defined(CA_FLOAT_IEEE) && 0
/*
* htond ()
@@ -1600,6 +1600,7 @@ void ntohf(float *pNet, float *pHost)
*/
void htond (double *IEEEhost, double *IEEEnet)
{
#ifdef CA_LITTLE_ENDIAN
ca_uint32_t *pHost = (ca_uint32_t *) IEEEhost;
ca_uint32_t *pNet = (ca_uint32_t *) IEEEnet;
ca_uint32_t tmp;
@@ -1612,6 +1613,9 @@ void htond (double *IEEEhost, double *IEEEnet)
tmp = pHost[0];
pNet[0] = htonl (pHost[1]);
pNet[1] = htonl (tmp);
#else
*IEEEnet = *IEEEhost;
#endif
}
/*
@@ -1620,6 +1624,7 @@ void htond (double *IEEEhost, double *IEEEnet)
*/
void ntohd (double *IEEEnet, double *IEEEhost)
{
#ifdef CA_LITTLE_ENDIAN
ca_uint32_t *pHost = (ca_uint32_t *) IEEEhost;
ca_uint32_t *pNet = (ca_uint32_t *) IEEEnet;
ca_uint32_t tmp;
@@ -1632,6 +1637,9 @@ void ntohd (double *IEEEnet, double *IEEEhost)
tmp = pNet[0];
pHost[0] = ntohl (pNet[1]);
pHost[1] = htonl (tmp);
#else
*IEEEhost = *IEEEnet;
#endif
}
/*
@@ -1658,7 +1666,7 @@ void htonf (float *IEEEhost, float *IEEEnet)
*pNet = htonl (*pHost);
}
#endif /* not CA_MIT_FLOAT*/
#endif /* IEEE float and little endian */

View File

@@ -95,6 +95,5 @@ void flow_control(struct ioc_in_use *piiu)
}
UNLOCK;
return;
}

View File

@@ -219,7 +219,7 @@ int net_proto
IPPROTO_TCP,
TCP_NODELAY,
(char *)&true,
sizeof true);
sizeof(true));
if(status < 0){
free(piiu);
status = socket_close(sock);
@@ -270,57 +270,53 @@ int net_proto
#endif
#ifdef CA_SET_TCP_BUFFER_SIZES
/* set TCP buffer sizes */
i = MAX_MSG_SIZE;
status = setsockopt(
sock,
SOL_SOCKET,
SO_SNDBUF,
&i,
sizeof(i));
if(status < 0){
free(piiu);
status = socket_close(sock);
if(status<0){
SEVCHK(ECA_INTERNAL,NULL);
}
UNLOCK;
return ECA_SOCK;
}
i = MAX_MSG_SIZE;
status = setsockopt(
sock,
SOL_SOCKET,
SO_RCVBUF,
&i,
sizeof(i));
if(status < 0){
free(piiu);
status = socket_close(sock);
if(status<0){
SEVCHK(ECA_INTERNAL,NULL);
}
UNLOCK;
return ECA_SOCK;
}
{
int i;
int size;
/* fetch the TCP send buffer size */
i = sizeof(piiu->tcp_send_buff_size);
status = getsockopt(
sock,
SOL_SOCKET,
SO_SNDBUF,
(char *)&piiu->tcp_send_buff_size,
&i);
if(status < 0 || i != sizeof(piiu->tcp_send_buff_size)){
free(piiu);
status = socket_close(sock);
if(status<0){
SEVCHK(ECA_INTERNAL,NULL);
/* set TCP buffer sizes */
i = MAX_MSG_SIZE;
status = setsockopt(
sock,
SOL_SOCKET,
SO_SNDBUF,
&i,
sizeof(i));
if(status < 0){
free(piiu);
socket_close(sock);
UNLOCK;
return ECA_SOCK;
}
UNLOCK;
return ECA_SOCK;
}
i = MAX_MSG_SIZE;
status = setsockopt(
sock,
SOL_SOCKET,
SO_RCVBUF,
&i,
sizeof(i));
if(status < 0){
free(piiu);
socket_close(sock);
UNLOCK;
return ECA_SOCK;
}
/* fetch the TCP send buffer size */
i = sizeof(size);
status = getsockopt(
sock,
SOL_SOCKET,
SO_SNDBUF,
(char *)&size,
&i);
if(status < 0 || i != sizeof(size)){
free(piiu);
socket_close(sock);
UNLOCK;
return ECA_SOCK;
}
}
#endif
/* connect */
@@ -342,20 +338,6 @@ int net_proto
cacRingBufferInit(&piiu->recv, sizeof(piiu->send.buf));
cacRingBufferInit(&piiu->send, sizeof(piiu->send.buf));
/*
* Set non blocking IO
* to prevent dead locks
*/
status = socket_ioctl(
piiu->sock_chan,
FIONBIO,
&true);
if(status<0){
ca_printf(
"Error setting non-blocking io: %s\n",
strerror(MYERRNO));
}
/*
* Save the Host name for efficient access in the
* future.
@@ -435,6 +417,7 @@ int net_proto
sock,
ca_static->ca_server_port);
cacRingBufferInit(&piiu->recv, sizeof(piiu->send.buf));
cacRingBufferInit(&piiu->send, min(MAX_UDP,
sizeof(piiu->send.buf)));
@@ -443,7 +426,6 @@ int net_proto
piiu->host_name_str,
"<<unknown host>>",
sizeof(piiu->host_name_str)-1);
break;
default:
@@ -456,6 +438,20 @@ int net_proto
return ECA_INTERNAL;
}
/*
* Set non blocking IO
* to prevent dead locks
*/
status = socket_ioctl(
piiu->sock_chan,
FIONBIO,
&true);
if(status<0){
ca_printf(
"Error setting non-blocking io: %s\n",
strerror(MYERRNO));
}
if(fd_register_func){
LOCKEVENTS;
(*fd_register_func)(fd_register_arg, sock, TRUE);
@@ -571,21 +567,34 @@ void notify_ca_repeater()
LOCK; /*MULTINET TCP/IP routines are not reentrant*/
status = local_addr(piiuCast->sock_chan, &saddr);
if (status == OK) {
int len;
memset((char *)&msg, 0, sizeof(msg));
msg.m_cmmd = htons(REPEATER_REGISTER);
msg.m_available = saddr.sin_addr.s_addr;
saddr.sin_port = htons(ca_static->ca_repeater_port);
/*
* Intentionally sending a zero length message here
* until most CA repeater daemons have been restarted
* (and only then will accept the above protocol)
* (repeaters began accepting this protocol
* starting with EPICS 3.12)
*
* SOLARIS will not accept a zero length message
* and we are just porting there for 3.12 so
* we will use the new protocol for 3.12
*/
# ifdef SOLARIS
len = sizeof(msg);
# else /* SOLARIS */
len = 0;
# endif /* SOLARIS */
status = sendto(
piiuCast->sock_chan,
(char *)&msg, /* UCX requires a valid address here */
0, /* <= sizeof(msg) ! see comment above ! */
len,
0,
(struct sockaddr *)&saddr,
sizeof(saddr));
@@ -655,9 +664,13 @@ LOCAL void cac_udp_send_msg_piiu(struct ioc_in_use *piiu)
localErrno = MYERRNO;
if( localErrno != EWOULDBLOCK &&
localErrno != ENOBUFS &&
localErrno != EINTR){
if( localErrno == EWOULDBLOCK &&
localErrno == ENOBUFS &&
localErrno == EINTR){
UNLOCK;
return;
}
else {
ca_printf(
"CAC: error on socket send() %s\n",
strerror(localErrno));
@@ -705,34 +718,52 @@ LOCAL void cac_tcp_send_msg_piiu(struct ioc_in_use *piiu)
LOCK;
sendCnt = cacRingBufferReadSize(&piiu->send, TRUE);
assert(sendCnt<=piiu->send.max_msg);
/*
* return if nothing to send
* Check at least twice to see if there is anything
* in the ring buffer (in case the block of messages
* isnt continuous). Always return if the send was
* less bytes than requested.
*/
if(sendCnt == 0){
UNLOCK;
return;
}
while (TRUE) {
sendCnt = cacRingBufferReadSize(&piiu->send, TRUE);
assert(sendCnt<=piiu->send.max_msg);
status = send(
piiu->sock_chan,
&piiu->send.buf[piiu->send.rdix],
sendCnt,
0);
if(status>=0){
piiu->sendPending = FALSE;
CAC_RING_BUFFER_READ_ADVANCE(&piiu->send, status);
sendCnt = cacRingBufferReadSize(&piiu->send, FALSE);
if(sendCnt==0){
/*
* return if nothing to send
*/
if(sendCnt == 0){
# ifdef DEBUG
if (piiu->sendPending) {
printf ("-Unblocked-\n");
}
# endif /* DEBUG */
piiu->sendPending = FALSE;
piiu->send_needed = FALSE;
UNLOCK;
return;
}
UNLOCK;
return;
status = send(
piiu->sock_chan,
&piiu->send.buf[piiu->send.rdix],
sendCnt,
0);
if (status<0) {
break;
}
else if (status==0) {
TAG_CONN_DOWN(piiu);
UNLOCK;
return;
}
CAC_RING_BUFFER_READ_ADVANCE(&piiu->send, status);
if (status != sendCnt) {
UNLOCK;
return;
}
}
localError = MYERRNO;
@@ -741,10 +772,6 @@ LOCAL void cac_tcp_send_msg_piiu(struct ioc_in_use *piiu)
localError == ENOBUFS ||
localError == EINTR){
UNLOCK;
if(!piiu->sendPending){
cac_gettimeval(&piiu->timeAtSendBlock);
piiu->sendPending = TRUE;
}
return;
}
@@ -789,7 +816,6 @@ void cac_flush_internal()
UNLOCK;
}
/*
* cac_clean_iiu_list()
@@ -824,14 +850,16 @@ void ca_process_input_queue()
{
struct ioc_in_use *piiu;
LOCK;
/*
* dont allow recursion
* dont allow recursion
*/
if(post_msg_active){
UNLOCK;
return;
}
LOCK;
for( piiu=(IIU *)iiuList.node.next;
piiu;
piiu=(IIU *)piiu->node.next){
@@ -842,9 +870,12 @@ void ca_process_input_queue()
(*piiu->procInput)(piiu);
}
UNLOCK;
#if 0
cac_flush_internal();
#endif
}
@@ -864,55 +895,59 @@ LOCAL void tcp_recv_msg(struct ioc_in_use *piiu)
LOCK;
writeSpace = cacRingBufferWriteSize(&piiu->recv, TRUE);
if(writeSpace == 0){
UNLOCK;
return;
}
/*
* Check at least twice to see if there is ana space left
* in the ring buffer (in case the messages block
* isnt continuous). Always return if the send was
* less bytes than requested.
*/
while (TRUE) {
status = recv( piiu->sock_chan,
&piiu->recv.buf[piiu->recv.wtix],
writeSpace,
0);
if(status == 0){
TAG_CONN_DOWN(piiu);
UNLOCK;
return;
}
else if(status <0){
/* try again on status of -1 and no luck this time */
if(MYERRNO == EWOULDBLOCK || MYERRNO == EINTR){
UNLOCK;
return;
writeSpace = cacRingBufferWriteSize(&piiu->recv, TRUE);
if(writeSpace == 0){
break;
}
if( MYERRNO != EPIPE &&
MYERRNO != ECONNRESET &&
MYERRNO != ETIMEDOUT){
ca_printf(
"CAC: unexpected recv error (err=%s)\n",
strerror(MYERRNO));
status = recv( piiu->sock_chan,
&piiu->recv.buf[piiu->recv.wtix],
writeSpace,
0);
if(status == 0){
TAG_CONN_DOWN(piiu);
break;
}
TAG_CONN_DOWN(piiu);
UNLOCK;
return;
}
else if(status <0){
/* try again on status of -1 and no luck this time */
if(MYERRNO == EWOULDBLOCK || MYERRNO == EINTR){
break;
}
if(status>MAX_MSG_SIZE){
ca_printf( "CAC: recv_msg(): message overflow %l\n",
status-MAX_MSG_SIZE);
TAG_CONN_DOWN(piiu);
UNLOCK;
return;
}
if( MYERRNO != EPIPE &&
MYERRNO != ECONNRESET &&
MYERRNO != ETIMEDOUT){
ca_printf(
"CAC: unexpected recv error (err=%s)\n",
strerror(MYERRNO));
}
TAG_CONN_DOWN(piiu);
break;
}
CAC_RING_BUFFER_WRITE_ADVANCE(&piiu->recv, status);
assert (status<=writeSpace);
CAC_RING_BUFFER_WRITE_ADVANCE(&piiu->recv, status);
/*
* Record the time whenever we receive a message
* from this IOC
*/
piiu->timeAtLastRecv = ca_static->currentTime;
if (status != writeSpace) {
break;
}
}
/*
* Record the time whenever we receive a message
* from this IOC
*/
cac_gettimeval(&piiu->timeAtLastRecv);
UNLOCK;
return;
@@ -929,18 +964,20 @@ LOCAL void ca_process_tcp(struct ioc_in_use *piiu)
int status;
long bytesToProcess;
LOCK;
/*
* dont allow recursion
*/
if(post_msg_active){
UNLOCK;
return;
}
pNode = (caAddrNode *) piiu->destAddr.node.next;
post_msg_active = TRUE;
LOCK;
pNode = (caAddrNode *) piiu->destAddr.node.next;
while(TRUE){
bytesToProcess = cacRingBufferReadSize(&piiu->recv, TRUE);
if(bytesToProcess == 0){
@@ -963,9 +1000,9 @@ LOCAL void ca_process_tcp(struct ioc_in_use *piiu)
&piiu->recv,
bytesToProcess);
}
UNLOCK;
post_msg_active = FALSE;
UNLOCK;
flow_control(piiu);
@@ -1066,17 +1103,18 @@ LOCAL void ca_process_udp(struct ioc_in_use *piiu)
char *pBuf;
unsigned long bytesAvailable;
LOCK;
/*
* dont allow recursion
*/
if(post_msg_active){
UNLOCK;
return;
}
post_msg_active = TRUE;
LOCK;
while(TRUE){
bytesAvailable = cacRingBufferReadSize(&piiu->recv, TRUE);
@@ -1124,9 +1162,8 @@ LOCAL void ca_process_udp(struct ioc_in_use *piiu)
bytesAvailable);
}
UNLOCK;
post_msg_active = FALSE;
UNLOCK;
return;
}
@@ -1514,6 +1551,8 @@ unsigned long cacRingBufferWriteSize(struct ca_buffer *pBuf, int contiguous)
* vxWorks user will need to configure a DNS format name for the
* host name if they wish to be cnsistent with UNIX and VMS hosts.
*
* this needs to attempt to determine if the process is a remote
* login - hard to do under UNIX
*/
char *localHostName()
{

View File

@@ -80,7 +80,6 @@ HDRVERSIONID(iocinfh, "$Id$")
*/
#include <ctype.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <signal.h>
#include <stdlib.h>
@@ -96,10 +95,12 @@ HDRVERSIONID(iocinfh, "$Id$")
/*
* EPICS includes
*/
#include <epicsAssert.h>
#include <cadef.h>
#include <bucketLib.h>
#include <ellLib.h>
#include <envDefs.h>
#include <epicsPrint.h>
/*
* CA private includes
@@ -119,8 +120,8 @@ HDRVERSIONID(iocinfh, "$Id$")
# define NBBY 8 /* number of bits per byte */
#endif
#define MSEC_PER_SEC 1000
#define USEC_PER_SEC 1000000
#define MSEC_PER_SEC 1000L
#define USEC_PER_SEC 1000000L
/*
* catch when they use really large strings
@@ -170,7 +171,7 @@ typedef struct timeval ca_time;
#define LD_CA_TIME(FLOAT_TIME,PCATIME) \
((PCATIME)->tv_sec = (long) (FLOAT_TIME), \
(PCATIME)->tv_usec = (long) ((FLOAT_TIME)-(PCATIME)->tv_sec)*USEC_PER_SEC)
(PCATIME)->tv_usec = (long) ( ((FLOAT_TIME)-(PCATIME)->tv_sec)*USEC_PER_SEC ))
/*
* dont adjust
@@ -189,8 +190,8 @@ extern const ca_time CA_CURRENT_TIME;
*/
#define MAXCONNTRIES 30 /* N conn retries on unchanged net */
#define SELECT_POLL (0.1) /* units sec - polls into recast */
#define CA_RECAST_DELAY (0.1) /* initial delay to next recast (sec) */
#define SELECT_POLL (0.05) /* units sec - polls into recast */
#define CA_RECAST_DELAY (0.1) /* initial delay to next recast (sec) */
#define CA_RECAST_PORT_MASK 0xff /* random retry interval off port */
#define CA_RECAST_PERIOD (5.0) /* ul on retry period long term (sec) */
@@ -213,7 +214,7 @@ extern const ca_time CA_CURRENT_TIME;
#define CA_RETRY_PERIOD 5 /* int sec to next keepalive */
#define N_REPEATER_TRIES_PRIOR_TO_MSG 50
#define REPEATER_TRY_PERIOD (0.1)
#define REPEATER_TRY_PERIOD (1.0)
#ifdef vxWorks
typedef struct caclient_put_notify{
@@ -317,7 +318,7 @@ struct ca_buffer{
#define TAG_CONN_DOWN(PIIU) \
( \
/*ca_printf("Tagging connection down at %d in %s\n", __LINE__, __FILE__),*/ \
/* ca_printf("Tagging connection down at %d in %s\n", __LINE__, __FILE__), */\
(PIIU)->conn_up = FALSE \
)
@@ -396,6 +397,7 @@ struct ca_static{
ELLLIST putCvrtBuf;
ELLLIST fdInfoFreeList;
ELLLIST fdInfoList;
ca_time currentTime;
ca_time ca_conn_next_retry;
ca_time ca_conn_retry_delay;
ca_time ca_last_repeater_try;
@@ -410,7 +412,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);
int (*ca_printf_func)(const char *pformat, va_list args);
void (*ca_fd_register_func)
(void *, SOCKET, int);
void *ca_fd_register_arg;
@@ -594,7 +596,6 @@ 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

@@ -37,16 +37,18 @@ static char *sccsId = "@(#) $Id$";
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#ifdef _WINDOWS
#include <winsock.h>
# include <winsock.h>
#else
# include <sys/types.h>
# include <sys/socket.h>
# include <netinet/in.h>
# include <arpa/inet.h>
# include <netdb.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <epicsAssert.h>
/*

View File

@@ -40,6 +40,7 @@ static char *os_depenhSccsId = "$Id$";
* each socket library
*/
#ifdef UNIX
# include <unistd.h>
# include <errno.h>
# include <sys/types.h>
# include <sys/time.h>
@@ -49,6 +50,7 @@ static char *os_depenhSccsId = "$Id$";
# include <netinet/in.h>
# include <netinet/tcp.h>
# include <net/if.h>
# include <arpa/inet.h>
# define CA_OS_CONFIGURED
#endif
@@ -134,11 +136,8 @@ static char *os_depenhSccsId = "$Id$";
#endif
/*
* Big endin architecture is assumed. Otherwise set "CA_LITTLE_ENDIAN".
*
* IEEE floating point architecture assumed. Set "CA_FLOAT_MIT" if
* appropriate. No other floating point formats currently
* supported.
* Here are the definitions for architecture dependent byte ordering
* and floating point format
*/
#if defined(VAX)
# define CA_FLOAT_MIT

View File

@@ -66,50 +66,27 @@ void cac_gettimeval(struct timeval *pt)
void cac_mux_io(struct timeval *ptimeout)
{
int count;
int newInput;
struct timeval timeout;
cac_clean_iiu_list();
timeout = *ptimeout;
do{
/*
* manage search timers and detect disconnects
*/
manage_conn(TRUE);
count = cac_select_io(
&timeout,
CA_DO_RECVS | CA_DO_SENDS);
newInput = FALSE;
do{
count = cac_select_io(
&timeout,
CA_DO_RECVS | CA_DO_SENDS);
if(count>0){
newInput = TRUE;
}
timeout.tv_usec = 0;
timeout.tv_sec = 0;
}
while(count>0);
ca_process_input_queue();
/*
* manage search timers and detect disconnects
*/
manage_conn(TRUE);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
}
while(newInput);
}
log_time(char *pStr)
{
static struct timeval time;
struct timeval newtime;
struct timezone tz;
ca_real diff;
int status;
status = gettimeofday(&newtime, &tz);
assert(status==0);
diff = cac_time_diff(&newtime, &time);
printf("Expired %f - %s\n", diff, pStr);
time = newtime;
while(count>0);
}
@@ -210,7 +187,7 @@ char *localUserName()
if(!pName){
pName = getpwuid(getuid())->pw_name;
if(!pName){
return NULL;
pName = "";
}
}
@@ -246,7 +223,7 @@ void ca_spawn_repeater()
/*
* return to the caller
* if its the in the initiating process
* if its in the initiating process
*/
if (status){
return;
@@ -260,7 +237,8 @@ void ca_spawn_repeater()
status = execlp(pImageName, NULL);
if(status<0){
ca_printf("!!WARNING!!\n");
ca_printf("The executable \"%s\" couldnt be located.\n", pImageName);
ca_printf("The executable \"%s\" couldnt be located\n", pImageName);
ca_printf("because - %s\n", strerror(MYERRNO));
ca_printf("You may need to modify your PATH environment variable.\n");
ca_printf("Creating CA repeater with fork() system call.\n");
ca_printf("Repeater will inherit parents process name and resources.\n");
@@ -279,6 +257,6 @@ void ca_spawn_repeater()
*/
void caSetDefaultPrintfHandler ()
{
ca_static->ca_printf_func = ca_default_printf;
ca_static->ca_printf_func = epicsVprintf;
}

View File

@@ -242,7 +242,7 @@ void ca_repeater()
/*
* register_new_client()
*/
void register_new_client(
LOCAL void register_new_client(
SOCKET sock,
struct sockaddr_in *pLocal,
struct sockaddr_in *pFrom)

View File

@@ -129,6 +129,10 @@ unsigned long blockSize
piiu->curMsgBytes += size;
if(piiu->curMsgBytes < sizeof(piiu->curMsg)){
#if 0
printf ("waiting for %d msg hdr bytes\n",
sizeof(piiu->curMsg)-piiu->curMsgBytes);
#endif
return OK;
}
@@ -174,10 +178,10 @@ unsigned long blockSize
if(piiu->pCurData){
free(piiu->pCurData);
}
piiu->curDataMax = 0;
piiu->pCurData = (void *)
malloc(piiu->curMsg.m_postsize);
if(!piiu->pCurData){
piiu->curDataMax = 0;
piiu->curMsgBytes = 0;
piiu->curDataBytes = 0;
return ERROR;
@@ -200,6 +204,10 @@ unsigned long blockSize
size);
piiu->curDataBytes += size;
if(piiu->curDataBytes < piiu->curMsg.m_postsize){
#if 0
printf ("waiting for %d msg bdy bytes\n",
piiu->curMsg.m_postsize-piiu->curDataBytes);
#endif
return OK;
}
pInBuf += size;
@@ -466,7 +474,6 @@ struct in_addr *pnet_addr
* read seq
*/
if (VALID_MSG(piiu)){
/*
* convert the data buffer from net
* format to host format
@@ -478,11 +485,19 @@ struct in_addr *pnet_addr
FALSE,
piiu->curMsg.m_count);
# else
memcpy(
(char *)pIOBlock->usr_arg,
piiu->pCurData,
dbr_size_n(piiu->curMsg.m_type,
piiu->curMsg.m_count));
if (piiu->curMsg.m_type == DBR_STRING) {
strcpy ((char *)pIOBlock->usr_arg,
piiu->pCurData);
}
else {
memcpy(
(char *)pIOBlock->usr_arg,
piiu->pCurData,
dbr_size_n (
piiu->curMsg.m_type,
piiu->curMsg.m_count)
);
}
# endif
/*

View File

@@ -203,7 +203,6 @@ int APIENTRY ca_sg_delete(CA_SYNC_GID gid)
int APIENTRY ca_sg_block(CA_SYNC_GID gid, ca_real timeout)
{
struct timeval beg_time;
struct timeval cur_time;
ca_real delay;
int status;
CASG *pcasg;
@@ -244,7 +243,12 @@ int APIENTRY ca_sg_block(CA_SYNC_GID gid, ca_real timeout)
*/
ca_flush_io();
cac_gettimeval(&beg_time);
/*
* the current time set within ca_flush_io()
* above.
*/
beg_time = ca_static->currentTime;
delay = 0.0;
status = ECA_NORMAL;
while(pcasg->opPendCount){
@@ -254,8 +258,6 @@ int APIENTRY ca_sg_block(CA_SYNC_GID gid, ca_real timeout)
/*
* Exit if the timeout has expired
*/
cac_gettimeval (&cur_time);
delay = cac_time_diff (&cur_time, &beg_time);
remaining = timeout-delay;
if (remaining<=0.0) {
status = ECA_TIMEOUT;
@@ -273,6 +275,12 @@ int APIENTRY ca_sg_block(CA_SYNC_GID gid, ca_real timeout)
tmo.tv_sec = (long) remaining;
tmo.tv_usec = (long) ((remaining-tmo.tv_sec)*USEC_PER_SEC);
cac_block_for_sg_completion (pcasg, &tmo);
/*
* the current time set within cac_block_for_sg_completion()
* above.
*/
delay = cac_time_diff (&ca_static->currentTime, &beg_time);
}
pcasg->opPendCount = 0;
pcasg->seqNo++;

View File

@@ -68,35 +68,27 @@ void cac_gettimeval(struct timeval *pt)
void cac_mux_io(struct timeval *ptimeout)
{
int count;
int newInput;
struct timeval timeout;
cac_clean_iiu_list();
timeout = *ptimeout;
do{
count = cac_select_io(
&timeout,
CA_DO_RECVS | CA_DO_SENDS);
ca_process_input_queue();
/*
* manage search timers and detect disconnects
*/
manage_conn(TRUE);
newInput = FALSE;
do{
count = cac_select_io(
&timeout,
CA_DO_RECVS | CA_DO_SENDS);
if(count>0){
newInput = TRUE;
}
timeout.tv_usec = 0;
timeout.tv_sec = 0;
}
while(count>0);
ca_process_input_queue();
timeout.tv_sec = 0;
timeout.tv_usec = 0;
}
while(newInput);
while(count>0);
}
@@ -174,11 +166,7 @@ void cac_os_depen_exit (struct ca_static *pcas)
/*
*
* localUserName() - for VMS
*
* o Indicates failure by setting ptr to nill
*
*/
char *localUserName()
{
@@ -221,24 +209,13 @@ char *localUserName()
NULL,
NULL,
NULL);
if(status != SS$_NORMAL){
return NULL;
strcpy (pName, "");
}
/*
* test for remote login
*/
if(jobTypeSize != sizeof(jobType)){
return NULL;
}
/*
* This does not appear to change when it is
* a remote login ??
*/
if(jobType != JPI$K_LOCAL && jobType != JPI$K_DETACHED){
pTmp = "REMOTE";
return pTmp;
strcpy (pName, "");
}
/*
@@ -332,6 +309,6 @@ void caHostFromInetAddr(struct in_addr *pnet_addr, char *pBuf, unsigned size)
*/
void caSetDefaultPrintfHandler ()
{
ca_static->ca_printf_func = ca_default_printf;
ca_static->ca_printf_func = epicsVprintf;
}

View File

@@ -34,7 +34,6 @@
#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);
@@ -105,7 +104,6 @@ void cac_mux_io(struct timeval *ptimeout)
#if NOASYNCRECV
cac_clean_iiu_list();
manage_conn(TRUE);
#endif
timeout = *ptimeout;
do{
@@ -119,6 +117,7 @@ void cac_mux_io(struct timeval *ptimeout)
#if NOASYNCRECV
ca_process_input_queue();
manage_conn(TRUE);
#endif
}
@@ -757,7 +756,7 @@ void ca_spawn_repeater()
/*
* ca_repeater_task()
*/
void ca_repeater_task()
LOCAL void ca_repeater_task()
{
taskwdInsert((int)taskIdCurrent, NULL, NULL);
ca_repeater();
@@ -848,6 +847,7 @@ void cac_recv_task(int tid)
{
struct timeval timeout;
int status;
int count;
taskwdInsert((int) taskIdCurrent, NULL, NULL);
@@ -862,18 +862,16 @@ void cac_recv_task(int tid)
#if NOASYNCRECV
taskDelay(60);
#else
manage_conn(TRUE);
timeout.tv_usec = 0;
timeout.tv_sec = 1;
cac_clean_iiu_list();
cac_select_io(
&timeout,
CA_DO_RECVS);
timeout.tv_usec = 50000;
timeout.tv_sec = 0;
count = cac_select_io(
&timeout,
CA_DO_SENDS | CA_DO_RECVS);
ca_process_input_queue();
ca_process_input_queue();
manage_conn(TRUE);
#endif
}
}
@@ -892,6 +890,6 @@ void cac_recv_task(int tid)
*/
void caSetDefaultPrintfHandler ()
{
ca_static->ca_printf_func = vmprintf;
ca_static->ca_printf_func = epicsVprintf;
}

View File

@@ -2,6 +2,7 @@
* $Id$
* Author: Jeffrey O. Hill, Chris Timossi
* hill@luke.lanl.gov
* CATimossi@lbl.gov
* (505) 665 1831
* Date: 9-93
*
@@ -31,12 +32,22 @@
*
*/
/*
* Windows includes
*/
#include <process.h>
#include "iocinf.h"
#ifndef _WINDOWS
#error This source is specific to DOS/WINDOS
#endif
static int get_subnet_mask ( char SubNetMaskStr[256]);
static int RegTcpParams (char IpAddr[256], char SubNetMask[256]);
static int RegKeyData (CHAR *RegPath, HANDLE hKeyRoot, LPSTR lpzValueName,
LPDWORD lpdwType, LPBYTE lpbData, LPDWORD lpcbData );
/*
* cac_gettimeval
@@ -64,35 +75,27 @@ void cac_gettimeval(struct timeval *pt)
void cac_mux_io(struct timeval *ptimeout)
{
int count;
int newInput;
struct timeval timeout;
cac_clean_iiu_list();
timeout = *ptimeout;
do{
/*
* manage search timers and detect disconnects
*/
manage_conn(TRUE); newInput = FALSE;
do{
count = cac_select_io(
&timeout,
CA_DO_RECVS | CA_DO_SENDS);
if(count>0){
newInput = TRUE;
}
timeout.tv_usec = 0;
timeout.tv_sec = 0;
}
while(count>0);
count = cac_select_io(
&timeout,
CA_DO_RECVS | CA_DO_SENDS);
ca_process_input_queue();
}
while(newInput);
/*
* manage search timers and detect disconnects
*/
manage_conn(TRUE);
timeout.tv_sec = 0;
timeout.tv_usec = 0;
}
while(count>0);
}
@@ -135,7 +138,8 @@ void cac_block_for_sg_completion(CASG *pcasg, struct timeval *pTV)
*/
int cac_os_depen_init(struct ca_static *pcas)
{
int status;
int status;
WSADATA WsaData;
ca_static = pcas;
@@ -146,16 +150,17 @@ int cac_os_depen_init(struct ca_static *pcas)
* allow error to be returned to sendto()
* instead of handling disconnect at interrupt
*/
signal(SIGPIPE,SIG_IGN);
/* signal(SIGPIPE,SIG_IGN); */
# ifdef _WINSOCKAPI_
status = WSAStartup(MAKEWORD(1,1), &WsaData));
status = WSAStartup(MAKEWORD(1,1), &WsaData);
assert (status==0);
# endif
status = ca_os_independent_init ();
return status;
return status;
}
@@ -180,12 +185,16 @@ void cac_os_depen_exit (struct ca_static *pcas)
*/
char *localUserName()
{
int length;
char *pName;
char *pTmp;
int length;
char *pName;
char *pTmp;
char Uname[] = "";
pName = "Joe PC";
length = strlen(pName)+1;
pName = getenv("USERNAME");
if (!pName) {
pName = Uname;
}
length = strlen(pName)+1;
pTmp = malloc(length);
if(!pTmp){
@@ -211,8 +220,13 @@ void ca_spawn_repeater()
* running in the repeater process
* if here
*/
pImageName = "caRepeater";
status = system(pImageName);
pImageName = "caRepeater.exe";
//status = system(pImageName);
//Need to check if repeater is already loaded
//For now, start Repeater from a command line, not here
status = 0;
//status = _spawnlp(_P_DETACH,pImageName,"");
if(status<0){
ca_printf("!!WARNING!!\n");
ca_printf("Unable to locate the executable \"%s\".\n",
@@ -229,15 +243,198 @@ void ca_spawn_repeater()
*/
void caSetDefaultPrintfHandler ()
{
ca_static->ca_printf_func = ca_default_printf;
ca_static->ca_printf_func = epicsVprintf;
}
/*
* DllMain ()
*
* Network interface routines
*
*/
BOOL APIENTRY DllMain (HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
/*
* local_addr()
*
* return 127.0.0.1
* (the loop back address)
*/
int local_addr (SOCKET s, struct sockaddr_in *plcladdr)
{
ca_uint32_t loopBackAddress = 0x7f000001;
plcladdr->sin_family = AF_INET;
plcladdr->sin_port = 0;
plcladdr->sin_addr.s_addr = ntohl (loopBackAddress);
return OK;
}
/*
* caDiscoverInterfaces()
*
* This routine is provided with the address of an ELLLIST a socket
* and a destination port number. When the routine returns there
* will be one additional inet address (a caAddrNode) in the list
* for each inet interface found that is up and isnt a loop back
* interface. If the interface supports broadcast then I add its
* broadcast address to the list. If the interface is a point to
* point link then I add the destination address of the point to
* point link to the list. In either case I set the port number
* in the address node to the port supplied in the argument
* list.
*
* LOCK should be applied here for (pList)
* (this is also called from the server)
*/
void caDiscoverInterfaces(ELLLIST *pList, SOCKET socket, int port)
{
struct sockaddr_in localAddr;
struct sockaddr_in InetAddr;
struct in_addr bcast_addr;
caAddrNode *pNode;
int status;
pNode = (caAddrNode *) calloc(1,sizeof(*pNode));
if(!pNode){
return;
}
broadcast_addr(&bcast_addr);
pNode->destAddr.inetAddr.sin_addr.s_addr = bcast_addr.s_addr; //broadcast addr
pNode->destAddr.inetAddr.sin_port = htons(port);
pNode->destAddr.inetAddr.sin_family = AF_INET;
//pNode->srcAddr.inetAddr = 0 ;//localAddr;
/*
* LOCK applied externally
*/
ellAdd(pList, &pNode->node);
}
int
broadcast_addr( struct in_addr *pcastaddr )
{
char netmask[256], lhostname[80];
static struct in_addr castaddr;
int status;
static char init = FALSE;
struct hostent *phostent;
unsigned long laddr;
if (init) {
*pcastaddr = castaddr;
return OK;
}
gethostname(lhostname,sizeof(lhostname));
phostent = gethostbyname(lhostname);
if (!phostent) {
return MYERRNO;
}
if (status = get_subnet_mask(netmask))
return ERROR;
laddr = *( (unsigned long *) phostent->h_addr_list[0]);
castaddr.s_addr = (laddr & inet_addr(netmask)) | ~inet_addr(netmask);
if (!init){
init = TRUE;
*pcastaddr = castaddr;
}
return OK;
}
static int get_subnet_mask ( char SubNetMaskStr[256])
{
char localadr[256];
return RegTcpParams (localadr, SubNetMaskStr);
}
static int RegTcpParams (char IpAddrStr[256], char SubNetMaskStr[256])
{
#define MAX_VALUE_NAME 128
static CHAR ValueName[MAX_VALUE_NAME];
static CHAR RegPath[256];
DWORD cbDataLen;
CHAR cbData[256];
DWORD dwType;
int status;
static char IpAddr[256], SubNetMask[256];
cbDataLen = sizeof(cbData);
strcpy(RegPath,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards\\1");
status = RegKeyData (RegPath, HKEY_LOCAL_MACHINE, "ServiceName", &dwType, cbData, &cbDataLen);
if (status) {
strcpy(RegPath,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards\\01");
status = RegKeyData (RegPath, HKEY_LOCAL_MACHINE, "ServiceName", &dwType, cbData, &cbDataLen);
if (status)
return status;
}
strcpy(RegPath,"SYSTEM\\CurrentControlSet\\Services\\");
strcat(RegPath,cbData);
strcat(RegPath,"\\Parameters\\Tcpip");
cbDataLen = sizeof(IpAddr);
status = RegKeyData (RegPath, HKEY_LOCAL_MACHINE, "IPAddress", &dwType, IpAddr, &cbDataLen);
if (status)
return status;
strcpy(IpAddrStr,IpAddr);
cbDataLen = sizeof(SubNetMask);
status = RegKeyData (RegPath, HKEY_LOCAL_MACHINE, "SubnetMask", &dwType, SubNetMask, &cbDataLen);
if (status)
return status;
strcpy(SubNetMaskStr,SubNetMask);
return 0;
}
static int RegKeyData (CHAR *RegPath, HANDLE hKeyRoot, LPSTR lpzValueName,
LPDWORD lpdwType, LPBYTE lpbData, LPDWORD lpcbData )
{
HKEY hKey;
DWORD retCode;
DWORD dwcClassLen = MAX_PATH;
// OPEN THE KEY.
retCode = RegOpenKeyEx (hKeyRoot, // Key handle at root level.
RegPath, // Path name of child key.
0, // Reserved.
KEY_QUERY_VALUE, // Requesting read access.
&hKey); // Address of key to be returned.
if (retCode)
{
//wsprintf (Buf, "Error: RegOpenKeyEx = %d", retCode);
return -1;
}
retCode = RegQueryValueEx (hKey, // Key handle returned from RegOpenKeyEx.
lpzValueName, // Name of value.
NULL, // Reserved, dword = NULL.
lpdwType, // Type of data.
lpbData, // Data buffer.
lpcbData); // Size of data buffer.
if (retCode)
{
//wsprintf (Buf, "Error: RegQIK = %d, %d", retCode, __LINE__);
return -2;
}
return 0;
}
BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
{
int status;
WSADATA WsaData;
@@ -276,4 +473,3 @@ BOOL APIENTRY DllMain (HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
return TRUE;
}

View File

@@ -43,6 +43,8 @@
#include <dbDefs.h>
#include <callback.h>
#include <dbAccess.h>
#include <recSup.h>
#include <taskwd.h>
#include <errMdef.h>
#include <task_params.h>
@@ -164,3 +166,22 @@ static void wdCallback(long ind)
rngDelete(callbackQ[ind]);
start(ind);
}
static void ProcessCallback(CALLBACK *pCallback)
{
struct dbCommon *pRec;
callbackGetUser(pRec, pCallback);
dbScanLock(pRec);
((struct rset*)(pRec->rset))->process(pRec);
dbScanUnlock(pRec);
}
void callbackRequestProcessCallback(CALLBACK *pCallback, int Priority, void *pRec)
{
callbackSetCallback(ProcessCallback, pCallback);
callbackSetPriority(Priority, pCallback);
callbackSetUser(pRec, pCallback);
callbackRequest(pCallback);
}

View File

@@ -117,12 +117,10 @@ long dbCommonInit();
/*
* The lock structure for each database lock set. A lockset is the
* connected graph of all adjacent nodes to a record. A record
* is considered adjacent if the link connecting it to the lock
* set causes that record to process. In other words, a record
* is considered part of the lock set if the action of getting
* or putting a value to that record (with a link) causes that
* record to process.
* connected graph of all adjacent nodes to a record (with one
* exception, single-valued NPP NMS gets), where adjacent is defined
* as a record connected by a get, put, or forward link to the current
* record.
*/
struct scanLock {
FAST_LOCK lock;

View File

@@ -27,6 +27,7 @@
*
* Modification Log:
* -----------------
* $Log$
*/
/*
@@ -64,7 +65,7 @@
#include <vxLib.h>
#include <tickLib.h>
#include <sysLib.h>
#include <fast_lock.h>
#include <alarm.h>
#include <choice.h>
@@ -681,7 +682,15 @@ int dbBkpt(struct dbCommon *precord)
* breakpoint handler will not work as expected.
*/
/*
* Take and give a semaphore to check for breakpoints
* every time a record is processed. Slow. Thank
* goodness breakpoint checking is turned off during
* normal operation.
*/
semTake(bkpt_stack_sem, WAIT_FOREVER);
FIND_LOCKSET(precord, pnode);
semGive(bkpt_stack_sem);
if (pnode == NULL) {
/* no breakpoints in precord's lockset */

View File

@@ -62,7 +62,7 @@
* joh 21 080393 added task watch dog
*/
#include <assert.h>
#include <epicsAssert.h>
#include <vxWorks.h>
#include <types.h>

View File

@@ -97,6 +97,11 @@ static char *promptCAMAC_IO[] = {
"subaddress:",
" function:",
" parameter:"};
static char *promptRF_IO[] = {
" cryo:",
" micro:",
" dataset:",
" element:"};
static char *promptAB_IO[] = {
" link:",
" adapter:",
@@ -149,6 +154,7 @@ static void initForms()
promptAddr[PV_LINK] = promptPV_LINK; formlines[PV_LINK] = 4;
promptAddr[VME_IO] = promptVME_IO; formlines[VME_IO] = 3;
promptAddr[CAMAC_IO] = promptCAMAC_IO; formlines[CAMAC_IO] = 6;
promptAddr[RF_IO] = promptRF_IO; formlines[RF_IO] = 4;
promptAddr[AB_IO] = promptAB_IO; formlines[AB_IO] = 6;
promptAddr[GPIB_IO] = promptGPIB_IO; formlines[GPIB_IO] = 3;
promptAddr[BITBUS_IO]= promptBITBUS_IO;formlines[BITBUS_IO]= 5;
@@ -1338,6 +1344,13 @@ DBENTRY *pdbentry;
plink->value.camacio.n,plink->value.camacio.a,
plink->value.camacio.f,plink->value.camacio.parm);
break;
case RF_IO:
sprintf(message,"#R%d M%d D%d E%d",
plink->value.rfio.cryo,
plink->value.rfio.micro,
plink->value.rfio.dataset,
plink->value.rfio.element);
break;
case AB_IO:
sprintf(message,"#L%d A%d C%d S%d F%d @%s",
plink->value.abio.link,plink->value.abio.adapter,
@@ -1669,18 +1682,12 @@ 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'))) {
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);
}
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);
plink->value.camacio.parm[0] = 0;
if(end = strchr(pstr,'@')) {
pstr = end + 1;
@@ -1688,6 +1695,25 @@ char *pstring;
}
}
break;
case RF_IO: {
char *end;
if(!(end = strchr(pstr,'#'))) return (S_dbLib_badField);
pstr = end + 1;
if(!(end = strchr(pstr,'R'))) return (S_dbLib_badField);
pstr = end + 1;
sscanf(pstr,"%hd",&plink->value.rfio.cryo);
if(!(end = strchr(pstr,'M'))) return (S_dbLib_badField);
pstr = end + 1;
sscanf(pstr,"%hd",&plink->value.rfio.micro);
if(!(end = strchr(pstr,'D'))) return (S_dbLib_badField);
pstr = end + 1;
sscanf(pstr,"%hd",&plink->value.rfio.dataset);
if(!(end = strchr(pstr,'E'))) return (S_dbLib_badField);
pstr = end + 1;
sscanf(pstr,"%hd",&plink->value.rfio.element);
}
break;
case AB_IO: {
char *end;
@@ -2465,6 +2491,15 @@ DBENTRY *pdbentry;
value++;
strcpy(*value,plink->value.camacio.parm);
break;
case RF_IO:
cvtShortToString(plink->value.rfio.cryo,*value);
value++;
cvtShortToString(plink->value.rfio.micro,*value);
value++;
cvtShortToString(plink->value.rfio.dataset,*value);
value++;
cvtShortToString(plink->value.rfio.element,*value);
break;
case AB_IO:
cvtShortToString(plink->value.abio.link,*value);
value++;
@@ -2633,6 +2668,35 @@ char **value;
value++; verify++;
strncpy(plink->value.camacio.parm,*value,CAMAC_PARAM_SZ-1);
break;
case RF_IO:
lvalue = strtol(*value,&endp,0);
if(*endp==0) {
plink->value.rfio.cryo = lvalue; **verify = 0;
} else {
strcpy(*verify,"Illegal. Must be number");
}
value++; verify++;
lvalue = strtol(*value,&endp,0);
if(*endp==0) {
plink->value.rfio.micro = lvalue; **verify = 0;
} else {
strcpy(*verify,"Illegal. Must be number");
}
value++; verify++;
lvalue = strtol(*value,&endp,0);
if(*endp==0) {
plink->value.rfio.dataset = lvalue; **verify = 0;
} else {
strcpy(*verify,"Illegal. Must be number");
}
value++; verify++;
lvalue = strtol(*value,&endp,0);
if(*endp==0) {
plink->value.rfio.element = lvalue; **verify = 0;
} else {
strcpy(*verify,"Illegal. Must be number");
}
break;
case AB_IO:
lvalue = strtol(*value,&endp,0);
if(*endp==0) {

View File

@@ -389,8 +389,21 @@ long dbpf(char *pname,char *pvalue)
errMessage(status,"dbNameToAddr error");
return(1);
}
status=dbPutField(&addr,DBR_STRING,pvalue,1L);
if(status) 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=dbgf(pname);
return(status);
}

View File

@@ -45,6 +45,7 @@
* .08 05-28-93 joh Added an argument to devRegisterAddress()
* .09 05-28-93 joh Added devAddressMap()
* .10 06-14-93 joh Added devAllocAddress()
* .11 02-21-95 joh Fixed warning messages
*
* NOTES:
* .01 06-14-93 joh needs devAllocInterruptVector() routine
@@ -91,8 +92,8 @@ LOCAL char addrListInit;
typedef struct{
NODE node;
const char *pOwnerName;
void *pFirst;
void *pLast;
char *pFirst;
char *pLast;
}rangeItem;
/*
@@ -103,7 +104,8 @@ LOCAL char *defaultHandlerNames[] = {
"_excStub",
"_excIntStub",
"_unsolicitedHandlerEPICS"};
LOCAL void *defaultHandlerAddr[NELEMENTS(defaultHandlerNames)];
typedef void myISR (void *pParam);
LOCAL myISR *defaultHandlerAddr[NELEMENTS(defaultHandlerNames)];
/*
* These routines are not exported
@@ -112,21 +114,21 @@ LOCAL void initHandlerAddrList(void);
LOCAL int vectorInUse(unsigned vectorNumber);
LOCAL long initAddrList(void);
LOCAL long addrVerify(epicsAddressType addrType, void *address);
LOCAL void (*isrFetch(unsigned vectorNumber))();
LOCAL myISR *isrFetch(unsigned vectorNumber);
LOCAL long blockFind(
epicsAddressType addrType,
void *pBlockFirst,
void *pBlockLast,
char *pBlockFirst,
char *pBlockLast,
/* size needed */
unsigned long size,
/* n ls bits zero in base addr */
unsigned alignment,
/* base address found */
void **ppBase);
char **ppBase);
LOCAL long report_conflict(
epicsAddressType addrType,
void *pFirst,
void *pLast,
char *pFirst,
char *pLast,
const char *pOwnerName);
LOCAL long devInsertAddress(
LIST *pRangeList,
@@ -140,25 +142,25 @@ LOCAL long devInstallAddr(
rangeItem *pRange,
const char *pOwnerName,
epicsAddressType addrType,
void *pFirst,
void *pLast,
char *pFirst,
char *pLast,
void **pLocalAddress);
LOCAL long blockDivide(
epicsAddressType addrType,
void *pBlockFirst,
void *pBlockLast,
char *pBlockFirst,
char *pBlockLast,
/* base address found */
void **ppBase,
char **ppBase,
unsigned long requestSize
);
LOCAL long blockProbe(
epicsAddressType addrType,
void *pFirst,
void *pLast
char *pFirst,
char *pLast
);
long locationProbe(
epicsAddressType addrType,
void *pLocation
char *pLocation
);
/*
@@ -336,8 +338,8 @@ void *baseAddress,
unsigned long size,
void **pLocalAddress)
{
void *pFirst;
void *pLast;
char *pFirst;
char *pLast;
rangeItem *pRange;
long s;
@@ -357,7 +359,7 @@ void **pLocalAddress)
return S_dev_lowValue;
}
pFirst = baseAddress;
pFirst = (char *) baseAddress;
pLast = pFirst + size - 1;
FASTLOCK(&addrListLock);
@@ -407,25 +409,26 @@ LOCAL long devInstallAddr(
rangeItem *pRange, /* item on the free list to be split */
const char *pOwnerName,
epicsAddressType addrType,
void *pFirst,
void *pLast,
void **pLocalAddress)
char *pFirst,
char *pLast,
void **ppLocalAddress)
{
rangeItem *pNewRange;
int s;
if(pLocalAddress){
int s1;
int s2;
if(ppLocalAddress){
char *pAddr;
int s1;
int s2;
s1 = sysBusToLocalAdrs(
EPICStovxWorksAddrType[addrType],
pLast,
(char **)pLocalAddress);
&pAddr);
s2 = sysBusToLocalAdrs(
EPICStovxWorksAddrType[addrType],
pFirst,
(char **)pLocalAddress);
&pAddr);
if(s1 || s2){
errPrintf(
S_dev_vxWorksAddrMapFail,
@@ -437,6 +440,8 @@ void **pLocalAddress)
pLast-pFirst+1);
return S_dev_vxWorksAddrMapFail;
}
*ppLocalAddress = (void *) pAddr;
}
/*
@@ -505,8 +510,8 @@ void **pLocalAddress)
*/
LOCAL long report_conflict(
epicsAddressType addrType,
void *pFirst,
void *pLast,
char *pFirst,
char *pLast,
const char *pOwnerName
)
{
@@ -567,6 +572,7 @@ epicsAddressType addrType,
void *baseAddress,
const char *pOwnerName)
{
char *charAddress = (char *) baseAddress;
rangeItem *pRange;
int s;
@@ -577,7 +583,7 @@ const char *pOwnerName)
}
}
s = addrVerify(addrType, baseAddress);
s = addrVerify(addrType, charAddress);
if(s != SUCCESS){
return s;
}
@@ -585,10 +591,10 @@ const char *pOwnerName)
FASTLOCK(&addrListLock);
pRange = (rangeItem *) addrAlloc[addrType].node.next;
while(pRange){
if(pRange->pFirst == baseAddress){
if(pRange->pFirst == charAddress){
break;
}
if(pRange->pFirst > baseAddress){
if(pRange->pFirst > charAddress){
pRange = NULL;
break;
}
@@ -608,7 +614,7 @@ const char *pOwnerName)
__LINE__,
"unregister address for %s at 0X %X failed because %s owns it",
pOwnerName,
baseAddress,
charAddress,
pRange->pOwnerName);
return s;
}
@@ -730,7 +736,7 @@ void **pLocalAddress)
{
int s;
rangeItem *pRange;
void *pBase;
char *pBase;
s = addrVerify(addrType, (void *)size);
if(s){
@@ -745,9 +751,6 @@ void **pLocalAddress)
pRange = (rangeItem *) addrFree[addrType].node.next;
while(pRange){
if(pRange->pLast-pRange->pFirst>=size-1){
void *pF;
void *pL;
s = blockFind(
addrType,
pRange->pFirst,
@@ -875,9 +878,11 @@ LOCAL long devListAddressMap(LIST *pRangeList)
printf("%s Address Map\n", epicsAddressTypeName[i]);
}
while(pri){
printf("0X %08X - %08X %s\n",
pri->pFirst,
pri->pLast,
printf("0X %0*lX - %0*lX %s\n",
(int) (sizeof (pri->pFirst) * 2U),
(unsigned long) pri->pFirst,
(int) (sizeof (pri->pFirst) * 2U),
(unsigned long) pri->pLast,
pri->pOwnerName);
pri = (rangeItem *) lstNext(&pri->node);
}
@@ -923,9 +928,9 @@ void unsolicitedHandlerEPICS(int vectorNumber)
LOCAL
void initHandlerAddrList(void)
{
int i;
UINT8 type;
int status;
int i;
SYM_TYPE type;
int status;
for(i=0; i<NELEMENTS(defaultHandlerNames); i++){
status =
@@ -951,18 +956,17 @@ void initHandlerAddrList(void)
*
*
*/
LOCAL
void (*isrFetch(unsigned vectorNumber))()
LOCAL myISR *isrFetch(unsigned vectorNumber)
{
void (*psub)();
void (*pCISR)();
myISR *psub;
myISR *pCISR;
void *pParam;
int s;
/*
* fetch the handler or C stub attached at this vector
*/
psub = (void (*)()) intVecGet((FUNCPTR *)INUM_TO_IVEC(vectorNumber));
psub = (myISR *) intVecGet((FUNCPTR *)INUM_TO_IVEC(vectorNumber));
/*
* from libvxWorks/veclist.c
@@ -993,7 +997,7 @@ unsigned vectorNumber
{
static int init;
int i;
void (*psub)();
myISR *psub;
if(!init){
initHandlerAddrList();
@@ -1026,11 +1030,11 @@ unsigned vectorNumber
*/
LOCAL long blockFind(
epicsAddressType addrType,
void *pBlockFirst,
void *pBlockLast,
char *pBlockFirst,
char *pBlockLast,
unsigned long size, /* size needed */
unsigned alignment, /* n ls bits zero in base addr */
void **ppBase /* base address found */
char **ppBase /* base address found */
)
{
int s;
@@ -1041,7 +1045,7 @@ void **ppBase /* base address found */
*/
mask = devCreateMask(alignment);
if(mask&(long)pBlockFirst){
pBlockFirst = (void *) (mask | (unsigned long) pBlockFirst);
pBlockFirst = (char *) (mask | (unsigned long) pBlockFirst);
pBlockFirst++;
}
@@ -1088,17 +1092,17 @@ void **ppBase /* base address found */
*/
LOCAL long blockDivide(
epicsAddressType addrType,
void *pBlockFirst,
void *pBlockLast,
void **ppBase, /* base address found */
char *pBlockFirst,
char *pBlockLast,
char **ppBase, /* base address found */
unsigned long requestSize
)
{
void *pBlock;
char *pBlock;
unsigned long bs;
int s;
s = blockProbe(addrType,pBlockFirst, pBlockFirst+(requestSize-1));
s = blockProbe(addrType, pBlockFirst, pBlockFirst+(requestSize-1));
if(!s){
*ppBase = pBlockFirst;
return SUCCESS;
@@ -1137,11 +1141,11 @@ unsigned long requestSize
*/
LOCAL long blockProbe(
epicsAddressType addrType,
void *pFirst,
void *pLast
char *pFirst,
char *pLast
)
{
void *pProbe;
char *pProbe;
int s;
pProbe = pFirst;
@@ -1161,10 +1165,10 @@ void *pLast
*/
long locationProbe(
epicsAddressType addrType,
void *pLocation
char *pLocation
)
{
void *pPhysical;
char *pPhysical;
int s;
/*
@@ -1174,33 +1178,33 @@ void *pLocation
s = sysBusToLocalAdrs(
EPICStovxWorksAddrType[addrType],
pLocation,
(char **)&pPhysical);
&pPhysical);
if(s<0){
return S_dev_vxWorksAddrMapFail;
}
{
char *pChar;
char byte;
int8_t *pChar;
int8_t byte;
pChar = pPhysical;
pChar = (int8_t *) pPhysical;
if(devPtrAlignTest(pChar)){
s = vxMemProbe(
pChar,
(char *) pChar,
READ,
sizeof(byte),
&byte);
(char *) &byte);
if(s!=ERROR){
return S_dev_addressOverlap;
}
}
}
{
short *pWord;
short word;
int16_t *pWord;
int16_t word;
pWord = pPhysical;
pWord = (int16_t *)pPhysical;
if(devPtrAlignTest(pWord)){
s = vxMemProbe(
(char *)pWord,
@@ -1213,10 +1217,10 @@ void *pLocation
}
}
{
long *pLongWord;
long longWord;
int32_t *pLongWord;
int32_t longWord;
pLongWord = pPhysical;
pLongWord = (int32_t *) pPhysical;
if(devPtrAlignTest(pLongWord)){
s = vxMemProbe(
(char *)pLongWord,

View File

@@ -61,13 +61,13 @@
* .31 02-10-95 joh static => LOCAL
*/
#include <vxWorks.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <vxWorks.h>
#include <sysLib.h>
#include <symLib.h>
#include <sysSymTbl.h> /* for sysSymTbl*/
@@ -148,13 +148,7 @@ int iocInit(char * pResourceFilename)
return(-1);
}
/*
* Build the data structure for error reporting
*/
if ((errSymBld()) != 0) {
logMsg("iocInit aborting because errSymBld failed to initialize \n",0,0,0,0,0,0);
return(-1);
}
errInit(); /*Initialize errPrintf task*/
/*
* Setup initialization hooks, but only if an initHooks routine has been defined.

View File

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

View File

@@ -335,7 +335,7 @@ main(int argc, char** argv)
}
/* use sub_collect and db_file_name to do work */
int sub_it()
static int sub_it()
{
FILE* fp;
char var_buff[500];

View File

@@ -194,9 +194,8 @@ long dbInitSubst(char* parm_pattern)
case '\\': pp++; break; /* skip the next character */
case '=': subst_total++; break;
case '\"':
for(++pp;*pp && *pp!='\"';pp++);
if(*pp=='\\') pp++;
pp++;
for(++pp;*pp && *pp!='\"';pp++)
if(*pp=='\\') pp++;
break;
default: break;
}

View File

@@ -4,193 +4,191 @@ include $(EPICS)/config/CONFIG_BASE
USR_INCLUDES = -I../../drv
SRCS.c = \
../devAiDvx2502.c\
../devAiSoft.c\
../devAiSoftRaw.c\
../devAiSymb.c\
../devAiTestAsyn.c\
../devAiXy566Di.c\
../devAiXy566DiL.c\
../devAiXy566Se.c\
../devAoSoft.c\
../devApsEg.c\
../devApsEr.c\
../devAoSoftRaw.c\
../devAoSymb.c\
../devAoTestAsyn.c\
../devAoVmiVme4100.c\
../devBiMpv910.c\
../devBiSoft.c\
../devBiSoftRaw.c\
../devBiTestAsyn.c\
../devBiXVme210.c\
../devBoMpv902.c\
../devBoSoft.c\
../devBoSoftRaw.c\
../devBoTestAsyn.c\
../devBoXVme220.c\
../devCommonGpib.c\
../devEventSoft.c\
../devEventTestIoEvent.c\
../devHistogramSoft.c\
../devHistogramTestAsyn.c\
../devLiSoft.c\
../devLiSymb.c\
../devLoSoft.c\
../devLoSymb.c\
../devMbbiMpv910.c\
../devMbbiSoft.c\
../devMbbiSoftRaw.c\
../devMbbiTestAsyn.c\
../devMbbiXVme210.c\
../devMbboMpv902.c\
../devMbboSoft.c\
../devMbboSoftRaw.c\
../devMbboTestAsyn.c\
../devMbboXVme220.c\
../devMbbiDirectMpv910.c\
../devMbbiDirectSoft.c\
../devMbbiDirectSoftRaw.c\
../devMbbiDirectXVme210.c\
../devMbboDirectMpv902.c\
../devMbboDirectSoft.c\
../devMbboDirectSoftRaw.c\
../devMbboDirectXVme220.c\
../devPtSoft.c\
../devSmCompumotor1830.c\
../devSmOms6Axis.c\
../devSiSoft.c\
../devSiSymb.c\
../devSiTestAsyn.c\
../devSoSoft.c\
../devSASoft.c\
../devSoSymb.c\
../devSoTestAsyn.c\
../devWfSoft.c\
../devWfTestAsyn.c\
../devWfXy566Sc.c\
../devAllenBradley.c\
../devAt5Vxi.c\
../devMz8310.c\
../devTimerMz8310.c\
../devVxiTDM.c\
../devAiKscV215.c\
../devXy240.c\
../devHpe1368a.c\
../devAt8Fp.c\
../devWfComet.c\
../devWfDvx2502.c\
../devWfJoergerVtr1.c\
../devAvme9440.c\
../devSysmon.c
# ../devAiCamac.c\
# ../devAaiCamac.c\
# ../devBiCamac.c\
# ../devLiCamac.c\
# ../devMbbiCamac.c\
# ../devMbbiDirectCamac.c\
# ../devWfCamac.c\
# ../devAoCamac.c\
# ../devAaoCamac.c\
# ../devBoCamac.c\
# ../devLoCamac.c\
# ../devMbboCamac.c\
# ../devMbboDirectCamac.c
# SRCS.c += ../devAaiCamac.c
# SRCS.c += ../devAiCamac.c
SRCS.c += ../devAiDvx2502.c
SRCS.c += ../devAiKscV215.c
SRCS.c += ../devAiSoft.c
SRCS.c += ../devAiSoftRaw.c
SRCS.c += ../devAiSymb.c
SRCS.c += ../devAiTestAsyn.c
SRCS.c += ../devAiXy566Di.c
SRCS.c += ../devAiXy566DiL.c
SRCS.c += ../devAiXy566Se.c
SRCS.c += ../devAllenBradley.c
# SRCS.c += ../devAaoCamac.c
# SRCS.c += ../devAoCamac.c
SRCS.c += ../devAoSoft.c
SRCS.c += ../devAoSoftRaw.c
SRCS.c += ../devAoSymb.c
SRCS.c += ../devAoTestAsyn.c
SRCS.c += ../devAoVmiVme4100.c
SRCS.c += ../devApsEg.c
SRCS.c += ../devApsEr.c
SRCS.c += ../devAt5Vxi.c
SRCS.c += ../devAt8Fp.c
SRCS.c += ../devAvme9440.c
# SRCS.c += ../devBiCamac.c
SRCS.c += ../devBiMpv910.c
SRCS.c += ../devBiSoft.c
SRCS.c += ../devBiSoftRaw.c
SRCS.c += ../devBiTestAsyn.c
SRCS.c += ../devBiXVme210.c
# SRCS.c += ../devBoCamac.c
SRCS.c += ../devBoMpv902.c
SRCS.c += ../devBoSoft.c
SRCS.c += ../devBoSoftRaw.c
SRCS.c += ../devBoTestAsyn.c
SRCS.c += ../devBoXVme220.c
SRCS.c += ../devCommonGpib.c
SRCS.c += ../devEventSoft.c
SRCS.c += ../devEventTestIoEvent.c
SRCS.c += ../devHistogramSoft.c
SRCS.c += ../devHistogramTestAsyn.c
SRCS.c += ../devHpe1368a.c
# OBJS += devLiCamac.c
SRCS.c += ../devLiSoft.c
SRCS.c += ../devLiSymb.c
# OBJS += devLoCamac.c
SRCS.c += ../devLoSoft.c
SRCS.c += ../devLoSymb.c
# SRCS.c += ../devMbbiCamac.c
# SRCS.c += ../devMbbiDirectCamac.c
SRCS.c += ../devMbbiDirectMpv910.c
SRCS.c += ../devMbbiDirectSoft.c
SRCS.c += ../devMbbiDirectSoftRaw.c
SRCS.c += ../devMbbiDirectXVme210.c
SRCS.c += ../devMbbiMpv910.c
SRCS.c += ../devMbbiSoft.c
SRCS.c += ../devMbbiSoftRaw.c
SRCS.c += ../devMbbiTestAsyn.c
SRCS.c += ../devMbbiXVme210.c
# SRCS.c += ../devMbboCamac.c
# SRCS.c += ../devMbboDirectCamac.c
SRCS.c += ../devMbboDirectMpv902.c
SRCS.c += ../devMbboDirectSoft.c
SRCS.c += ../devMbboDirectSoftRaw.c
SRCS.c += ../devMbboDirectXVme220.c
SRCS.c += ../devMbboMpv902.c
SRCS.c += ../devMbboSoft.c
SRCS.c += ../devMbboSoftRaw.c
SRCS.c += ../devMbboTestAsyn.c
SRCS.c += ../devMbboXVme220.c
SRCS.c += ../devMz8310.c
SRCS.c += ../devPtSoft.c
SRCS.c += ../devSASoft.c
SRCS.c += ../devSiSoft.c
SRCS.c += ../devSiSymb.c
SRCS.c += ../devSiTestAsyn.c
SRCS.c += ../devSmCompumotor1830.c
SRCS.c += ../devSmOms6Axis.c
SRCS.c += ../devSoSoft.c
SRCS.c += ../devSoSymb.c
SRCS.c += ../devSoTestAsyn.c
SRCS.c += ../devSysmon.c
SRCS.c += ../devTimerMz8310.c
SRCS.c += ../devVxiTDM.c
# SRCS.c += ../devWfCamac.c
SRCS.c += ../devWfComet.c
SRCS.c += ../devWfDvx2502.c
SRCS.c += ../devWfJoergerVtr1.c
SRCS.c += ../devWfSoft.c
SRCS.c += ../devWfTestAsyn.c
SRCS.c += ../devWfXy566Sc.c
SRCS.c += ../devXy240.c
OBJS = \
devAiDvx2502.o\
devAiSoft.o\
devAiSoftRaw.o\
devAiSymb.o\
devAiTestAsyn.o\
devAiXy566Di.o\
devAiXy566DiL.o\
devAiXy566Se.o\
devAoSoft.o\
devAoSoftRaw.o\
devAoSymb.o\
devAoTestAsyn.o\
devAoVmiVme4100.o\
devBiMpv910.o\
devApsEg.o\
devApsEr.o\
devBiSoft.o\
devBiSoftRaw.o\
devBiTestAsyn.o\
devBiXVme210.o\
devBoMpv902.o\
devBoSoft.o\
devBoSoftRaw.o\
devBoTestAsyn.o\
devBoXVme220.o\
devCommonGpib.o\
devEventSoft.o\
devEventTestIoEvent.o\
devHistogramSoft.o\
devHistogramTestAsyn.o\
devLiSoft.o\
devLiSymb.o\
devLoSoft.o\
devLoSymb.o\
devMbbiMpv910.o\
devMbbiSoft.o\
devMbbiSoftRaw.o\
devMbbiTestAsyn.o\
devMbbiXVme210.o\
devMbboMpv902.o\
devMbboSoft.o\
devMbboSoftRaw.o\
devMbboTestAsyn.o\
devMbboXVme220.o\
devMbbiDirectMpv910.o\
devMbbiDirectSoft.o\
devMbbiDirectSoftRaw.o\
devMbbiDirectXVme210.o\
devMbboDirectMpv902.o\
devMbboDirectSoft.o\
devMbboDirectSoftRaw.o\
devMbboDirectXVme220.o\
devPtSoft.o\
devSmCompumotor1830.o\
devSmOms6Axis.o\
devSASoft.o\
devSiSoft.o\
devSiSymb.o\
devSiTestAsyn.o\
devSoSoft.o\
devSoSymb.o\
devSoTestAsyn.o\
devWfSoft.o\
devWfTestAsyn.o\
devWfXy566Sc.o\
devAllenBradley.o\
devAt5Vxi.o\
devMz8310.o\
devTimerMz8310.o\
devVxiTDM.o\
devAiKscV215.o\
devXy240.o\
devHpe1368a.o\
devAt8Fp.o\
devWfComet.o\
devWfDvx2502.o\
devWfJoergerVtr1.o\
devAvme9440.o\
devSysmon.o
# devAiCamac.o\
# devAaiCamac.o\
# devBiCamac.o\
# devLiCamac.o\
# devMbbiCamac.o\
# devMbbiDirectCamac.o\
# devWfCamac.o\
# devAoCamac.o\
# devAaoCamac.o\
# devBoCamac.o\
# devLoCamac.o\
# devMbboCamac.o\
# devMbboDirectCamac.o
# OBJS += devAaiCamac.o
# OBJS += devAiCamac.o
OBJS += devAiDvx2502.o
OBJS += devAiKscV215.o
OBJS += devAiSoft.o
OBJS += devAiSoftRaw.o
OBJS += devAiSymb.o
OBJS += devAiTestAsyn.o
OBJS += devAiXy566Di.o
OBJS += devAiXy566DiL.o
OBJS += devAiXy566Se.o
OBJS += devAllenBradley.o
# OBJS += devAaoCamac.o
# OBJS += devAoCamac.o
OBJS += devAoSoft.o
OBJS += devAoSoftRaw.o
OBJS += devAoSymb.o
OBJS += devAoTestAsyn.o
OBJS += devAoVmiVme4100.o
OBJS += devApsEg.o
OBJS += devApsEr.o
OBJS += devAt5Vxi.o
OBJS += devAt8Fp.o
OBJS += devAvme9440.o
# OBJS += devBiCamac.o
OBJS += devBiMpv910.o
OBJS += devBiSoft.o
OBJS += devBiSoftRaw.o
OBJS += devBiTestAsyn.o
OBJS += devBiXVme210.o
# OBJS += devBoCamac.o
OBJS += devBoMpv902.o
OBJS += devBoSoft.o
OBJS += devBoSoftRaw.o
OBJS += devBoTestAsyn.o
OBJS += devBoXVme220.o
OBJS += devCommonGpib.o
OBJS += devEventSoft.o
OBJS += devEventTestIoEvent.o
OBJS += devHistogramSoft.o
OBJS += devHistogramTestAsyn.o
OBJS += devHpe1368a.o
# OBJS += devLiCamac.o
OBJS += devLiSoft.o
OBJS += devLiSymb.o
# OBJS += devLoCamac.o
OBJS += devLoSoft.o
OBJS += devLoSymb.o
# OBJS += devMbbiCamac.o
# OBJS += devMbbiDirectCamac.o
OBJS += devMbbiDirectMpv910.o
OBJS += devMbbiDirectSoft.o
OBJS += devMbbiDirectSoftRaw.o
OBJS += devMbbiDirectXVme210.o
OBJS += devMbbiMpv910.o
OBJS += devMbbiSoft.o
OBJS += devMbbiSoftRaw.o
OBJS += devMbbiTestAsyn.o
OBJS += devMbbiXVme210.o
# OBJS += devMbboCamac.o
# OBJS += devMbboDirectCamac.o
OBJS += devMbboDirectMpv902.o
OBJS += devMbboDirectSoft.o
OBJS += devMbboDirectSoftRaw.o
OBJS += devMbboDirectXVme220.o
OBJS += devMbboMpv902.o
OBJS += devMbboSoft.o
OBJS += devMbboSoftRaw.o
OBJS += devMbboTestAsyn.o
OBJS += devMbboXVme220.o
OBJS += devMz8310.o
OBJS += devPtSoft.o
OBJS += devSASoft.o
OBJS += devSiSoft.o
OBJS += devSiSymb.o
OBJS += devSiTestAsyn.o
OBJS += devSmCompumotor1830.o
OBJS += devSmOms6Axis.o
OBJS += devSoSoft.o
OBJS += devSoSymb.o
OBJS += devSoTestAsyn.o
OBJS += devSysmon.o
OBJS += devTimerMz8310.o
OBJS += devVxiTDM.o
# OBJS += devWfCamac.o
OBJS += devWfComet.o
OBJS += devWfDvx2502.o
OBJS += devWfJoergerVtr1.o
OBJS += devWfSoft.o
OBJS += devWfTestAsyn.o
OBJS += devWfXy566Sc.o
OBJS += devXy240.o
PROD = devSup
@@ -200,3 +198,7 @@ $(PROD): $(OBJS)
$(RM) $@
$(LINK.c) $@ $(OBJS) $(LDLIBS)

View File

@@ -3,6 +3,9 @@
/*
* $Log$
* Revision 1.23 1995/01/06 16:55:52 winans
* Added the log parameter to the doc
*
*
* Author: John Winans
* Origional Author: Ned D. Arnold
@@ -2464,6 +2467,7 @@ void (*process)();
/* make sure the command type makes sendse for the record type */
if (parmBlock->gpibCmds[((struct gpibDpvt *)pwf->dpvt)->parm].type != GPIBREAD &&
parmBlock->gpibCmds[((struct gpibDpvt *)pwf->dpvt)->parm].type != GPIBWRITE &&
parmBlock->gpibCmds[((struct gpibDpvt *)pwf->dpvt)->parm].type != GPIBSOFT &&
parmBlock->gpibCmds[((struct gpibDpvt *)pwf->dpvt)->parm].type != GPIBREADW)
{
@@ -2540,9 +2544,11 @@ int
devGpibLib_wfGpibWork(pdpvt)
struct gpibDpvt *pdpvt;
{
int OperationStatus;
struct waveformRecord *pwf= ((struct waveformRecord *)(pdpvt->precord));
struct gpibCmd *pCmd;
struct devGpibParmBlock *parmBlock;
short ibnode = pdpvt->head.device;
parmBlock = (struct devGpibParmBlock *)(((gDset*)(pwf->dset))->funPtr[pwf->dset->number]);
@@ -2553,31 +2559,60 @@ struct gpibDpvt *pdpvt;
if(*(parmBlock->debugFlag))
printf("devGpibLib_wfGpibWork: starting ...command type = %d\n",pCmd->type);
if (devGpibLib_xxGpibWork(pdpvt, pCmd->type, -1) == ERROR)
{
devGpibLib_setPvSevr(pwf,READ_ALARM,VALID_ALARM);
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#endif
/**** Handle writes internally... the generic routine will not work ****/
if (pCmd->type == GPIBWRITE)
{
/*
* check to see if this node has timed out within last 10 sec
*/
if(tickGet() < (pdpvt->phwpvt->tmoVal + parmBlock->timeWindow) )
{
if (*parmBlock->debugFlag)
printf("devGpibLib_xxGpibWork(): timeout flush\n");
OperationStatus = ERROR;
}
else
{
OperationStatus = (*(drvGpib.writeIb))(pdpvt->head.pibLink,
ibnode, pdpvt->msg, pCmd->msgLen, pdpvt->head.dmaTimeout);
if(*parmBlock->debugFlag)
printf("devGpibLib_xxGpibWork : done, status = %d\n",OperationStatus);
/* if error occurrs then mark it with time */
if(OperationStatus == ERROR)
{
(pdpvt->phwpvt->tmoCount)++; /* count timeouts */
pdpvt->phwpvt->tmoVal = tickGet(); /* set last timeout time */
}
}
}
else
{
OperationStatus = devGpibLib_xxGpibWork(pdpvt, pCmd->type, -1);
}
if (OperationStatus == ERROR)
{
devGpibLib_setPvSevr(pwf,READ_ALARM,VALID_ALARM);
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
}
else
{
if (pCmd->type != GPIBREADW)
devGpibLib_wfGpibFinish(pdpvt); /* If not waiting on SRQ, finish */
else
{
if (*(parmBlock->debugFlag) || ibSrqDebug)
printf("%s: marking srq Handler for READW operation\n", parmBlock->name);
pdpvt->phwpvt->srqCallback = (int (*)())(((gDset*)(pwf->dset))->funPtr[pwf->dset->number + 2]);
pdpvt->phwpvt->parm = (caddr_t)pdpvt; /* mark the handler */
return(BUSY); /* indicate device still in use */
else
{
if (*(parmBlock->debugFlag) || ibSrqDebug)
printf("%s: marking srq Handler for READW operation\n", parmBlock->name);
pdpvt->phwpvt->srqCallback = (int (*)())(((gDset*)(pwf->dset))->funPtr[pwf->dset->number + 2]);
pdpvt->phwpvt->parm = (caddr_t)pdpvt; /* mark the handler */
return(BUSY); /* indicate device still in use */
}
}
}
return(IDLE); /* indicate device is now idle */
}
@@ -2608,13 +2643,7 @@ int srqStatus;
{
devGpibLib_setPvSevr(pwf,READ_ALARM,VALID_ALARM);
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#endif
}
devGpibLib_wfGpibFinish(pdpvt); /* and finish the processing */
@@ -2651,13 +2680,7 @@ struct gpibDpvt *pdpvt;
devGpibLib_setPvSevr(pwf,READ_ALARM,VALID_ALARM);
}
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#endif
return(0);
}

View File

@@ -4,17 +4,27 @@ include $(EPICS)/config/CONFIG_BASE
USR_INCLUDES = -I../../drv
SRCS.c = \
../devAnalytekGpib.c ../devXxDg535Gpib.c ../devBBInteract.c \
../devGpibInteract.c ../devXxSr620Gpib.c ../devK486Gpib.c \
../devXxK196Gpib.c ../devXxDc5009Gpib.c ../devXxK263Gpib.c \
../devXxSkeletonGpib.c
SRCS.c += ../devAnalytekGpib.c
SRCS.c += ../devXxDg535Gpib.c
SRCS.c += ../devBBInteract.c
SRCS.c += ../devGpibInteract.c
SRCS.c += ../devXxSr620Gpib.c
SRCS.c += ../devK486Gpib.c
SRCS.c += ../devXxK196Gpib.c
SRCS.c += ../devXxDc5009Gpib.c
SRCS.c += ../devXxK263Gpib.c
SRCS.c += ../devXxSkeletonGpib.c
OBJS = \
devAnalytekGpib.o devXxDg535Gpib.o devBBInteract.o \
devGpibInteract.o devXxSr620Gpib.o devK486Gpib.o \
devXxK196Gpib.o devXxDc5009Gpib.o devXxK263Gpib.o \
devXxSkeletonGpib.o
OBJS += devAnalytekGpib.o
OBJS += devXxDg535Gpib.o
OBJS += devBBInteract.o
OBJS += devGpibInteract.o
OBJS += devXxSr620Gpib.o
OBJS += devK486Gpib.o
OBJS += devXxK196Gpib.o
OBJS += devXxDc5009Gpib.o
OBJS += devXxK263Gpib.o
OBJS += devXxSkeletonGpib.o
PROD = devLibOpt $(OBJS)

View File

@@ -4,75 +4,74 @@ include $(EPICS)/config/CONFIG_BASE
USR_CFLAGS = -fshared-data -fvolatile -mnobitfield -traditional
SRCS.c = \
../module_types.c\
../drvXy010.c\
../drvAb.c\
../drvBb902.c\
../drvBb910.c\
../drvCompuSm.c\
../drvDvx.c\
../drvMz8310.c\
../drvOms.c\
../drvStc.c\
../drvTime.c\
../drvVmi4100.c\
../drvXy210.c\
../drvXy220.c\
../drvXy240.c\
../drvXy566.c\
../drvAt5Vxi.c\
../drvHp1404a.c\
../drvEpvxi.c\
../drvEpvxiMsg.c\
../drvBitBus.c\
../drvGpib.c\
../drvMsg.c\
../drvBB232.c\
../drvHpe1368a.c\
../drvHpe1445a.c\
../drvKscV215.c\
../drvComet.c\
../drvJgvtr1.c\
../drvFp.c\
../drvFpm.c
SRCS.c += ../module_types.c
SRCS.c += ../drvAb.c
SRCS.c += ../drvAt5Vxi.c
SRCS.c += ../drvBB232.c
SRCS.c += ../drvBb902.c
SRCS.c += ../drvBb910.c
SRCS.c += ../drvBitBus.c
# SRCS.c += ../drvCaenV265.c
SRCS.c += ../drvComet.c
SRCS.c += ../drvCompuSm.c
SRCS.c += ../drvDvx.c
SRCS.c += ../drvEpvxi.c
SRCS.c += ../drvEpvxiMsg.c
SRCS.c += ../drvFp.c
SRCS.c += ../drvFpm.c
SRCS.c += ../drvGpib.c
SRCS.c += ../drvHp1404a.c
SRCS.c += ../drvHpe1368a.c
SRCS.c += ../drvHpe1445a.c
SRCS.c += ../drvJgvtr1.c
SRCS.c += ../drvKscV215.c
SRCS.c += ../drvMsg.c
SRCS.c += ../drvMz8310.c
SRCS.c += ../drvOms.c
SRCS.c += ../drvStc.c
SRCS.c += ../drvTime.c
# SRCS.c += ../drvTranServ.c
SRCS.c += ../drvVmi4100.c
SRCS.c += ../drvXy010.c
SRCS.c += ../drvXy210.c
SRCS.c += ../drvXy220.c
SRCS.c += ../drvXy240.c
SRCS.c += ../drvXy566.c
# ../drvTranServ.c\
OBJS += module_types.o
OBJS += drvAb.o
OBJS += drvAt5Vxi.o
OBJS += drvBB232.o
OBJS += drvBb902.o
OBJS += drvBb910.o
OBJS += drvBitBus.o
# OBJS += drvCaenV265.o
OBJS += drvComet.o
OBJS += drvCompuSm.o
OBJS += drvDvx.o
OBJS += drvEpvxi.o
OBJS += drvEpvxiMsg.o
OBJS += drvFp.o
OBJS += drvFpm.o
OBJS += drvGpib.o
OBJS += drvHp1404a.o
OBJS += drvHpe1368a.o
OBJS += drvHpe1445a.o
OBJS += drvJgvtr1.o
OBJS += drvKscV215.o
OBJS += drvMsg.o
OBJS += drvMz8310.o
OBJS += drvOms.o
OBJS += drvStc.o
OBJS += drvTime.o
# OBJS += drvTranServ.o
OBJS += drvVmi4100.o
OBJS += drvXy010.o
OBJS += drvXy210.o
OBJS += drvXy220.o
OBJS += drvXy240.o
OBJS += drvXy566.o
OBJS = \
module_types.o\
drvXy010.o\
drvAb.o\
drvBb902.o\
drvBb910.o\
drvCompuSm.o\
drvDvx.o\
drvMz8310.o\
drvOms.o\
drvStc.o\
drvTime.o\
drvVmi4100.o\
drvXy210.o\
drvXy220.o\
drvXy240.o\
drvXy566.o\
drvAt5Vxi.o\
drvHp1404a.o\
drvEpvxi.o\
drvEpvxiMsg.o\
drvBitBus.o\
drvGpib.o\
drvMsg.o\
drvBB232.o\
drvHpe1368a.o\
drvHpe1445a.o\
drvKscV215.o\
drvComet.o\
drvJgvtr1.o\
drvFp.o\
drvFpm.o
# drvTranServ.o\
PROD = drvSup
@@ -83,5 +82,4 @@ $(PROD): $(OBJS)
$(LINK.c) $@ $(OBJS) $(LDLIBS)
# ../drvCaenV265.c\
# drvCaenV265.o\

View File

@@ -1,5 +1,6 @@
The CPU030 may need to have the nivxi path set correctly:
From the vxWorks shell type vxitedit
From the vxWorks shell type "vxitedit"
take option 2
take option 3
type list
@@ -8,6 +9,7 @@ The CPU030 may need to have the nivxi path set correctly:
(the path should end in nivxi
and should traverse the niCpu030
directories shipped with the 030
ie somethin of the form "???/config/niCPU030/nivxi"
type save
type exit
.

View File

@@ -1304,13 +1304,14 @@ abDoneTask(){
*
* simulate a change of state interrupt from the Allen-Bradley
*/
unsigned char ab_old_binary_ins[AB_MAX_LINKS*AB_MAX_ADAPTERS*AB_MAX_CARDS];
unsigned short ab_old_binary_ins[AB_MAX_LINKS][AB_MAX_ADAPTERS][AB_MAX_CARDS];
ab_bi_cos_simulator()
{
register struct ab_region *p6008;
register unsigned short link;
register unsigned short *pcard;
unsigned short *ps_input,*ps_oldval;
unsigned short new;
unsigned short *pold;
short adapter,card,inpinx;
short first_scan,first_scan_complete;
short adapter_status_change;
@@ -1323,8 +1324,6 @@ ab_bi_cos_simulator()
first_scan_complete = FALSE;
first_scan = TRUE;
for(;;){
/* check each link */
link = 0;
for (link = 0; link < AB_MAX_LINKS; link++){
if ((p6008 = p6008s[link]) == 0) continue;
for (adapter = 0; adapter < AB_MAX_ADAPTERS; adapter++){
@@ -1335,28 +1334,24 @@ ab_bi_cos_simulator()
for (card = 0; card < AB_MAX_CARDS; card++){
pcard = &ab_config[link][adapter][card];
inpinx = (adapter * AB_CARD_ADAPTER) + card;
pold = &ab_old_binary_ins[link][adapter][card];
if ((*pcard & AB_INTERFACE_TYPE) != AB_BI_INTERFACE) continue;
if ((*pcard & AB_CARD_TYPE) == ABBI_16_BIT){
/* sixteen bit byte ordering in dual ported memory */
/* byte 0011 2233 4455 6677 8899 AABB */
/* card 0000 2222 4444 6666 8888 AAAA */
if (inpinx & 0x1) continue;
ps_input = (unsigned short *)&(p6008->iit[inpinx]);
ps_oldval = (unsigned short *)&(ab_old_binary_ins[inpinx]);
if ((*ps_input != *ps_oldval) || first_scan || adapter_status_change){
scanIoRequest(ioscanpvt[link][adapter][card]);
*ps_oldval = *ps_input;
}
new = *(unsigned short *)&(p6008->iit[inpinx]);
}else{
/* eight bit byte ordering in dual ported memory */
/* 1100 3322 5544 7766 9988 BBAA */
if (inpinx & 0x1) inpinx--; /* shuffle those bytes */
else inpinx++;
if ((p6008->iit[inpinx] != ab_old_binary_ins[inpinx]) || first_scan || adapter_status_change){
scanIoRequest(ioscanpvt[link][adapter][card]);
ab_old_binary_ins[inpinx] = p6008->iit[inpinx];
}
new = (unsigned short)(p6008->iit[inpinx]);
}
if((new!=*pold) || first_scan || adapter_status_change){
scanIoRequest(ioscanpvt[link][adapter][card]);
*pold = new;
}
}
}

View File

@@ -450,10 +450,10 @@ struct at5vxi_model{
#define AT5VXI_MODEL_FROM_INDEX(INDEX) ((unsigned)((INDEX)|0xf00))
/*
NOTE: The macro AT5VXI_INDEX_FROM_MODEL(MODEL) defined above
should return an index into the correct data given the
VXI device's model code.
*/
* NOTE: The macro AT5VXI_INDEX_FROM_MODEL(MODEL) defined above
* should return an index into the correct data given the
* VXI device's model code.
*/
struct at5vxi_model at5vxi_models[] = {
{"INTERFACE SIMULATOR", "112Y-280158"},
{"I CONTROLLER", "112Y-280176"},
@@ -477,6 +477,16 @@ struct at5vxi_model at5vxi_models[] = {
{"DOWNCONVERTER", "112Y-280456"},
{"COAX MONITOR TRANSMITTER", "112Y-280587"},
{"CAVITY SIMULATOR", "112Y-280232"},
{"CABLE CONTROLLER (2 CHANNEL)","112Y-280539"},
{"BREADBOARD", "112Y-280358"},
{"I/O INTERFACE", "112Y-280359"},
{"DIAGNOSTIC - BPM", "112Y-280422-1"},
{"FAST ENVELOPE DETECTOR", "112Y-280421"},
{"DIAGNOSTIC - CM", "112Y-280422-2"},
{"DIAGNOSTIC - MISC", "112Y-280422-3"},
{"FAST VECTOR DETECTOR", "112Y-280651"},
{"SINGLE-WIDE VECTOR DETECTOR", "112Y-280672"},
{"FM / AM", "112Y-280xxx"}
};
#define AT5VXI_VALID_MODEL(MODEL) \

View File

@@ -65,6 +65,10 @@
* This driver currently needs work on error message generation.
*
* $Log$
* Revision 1.36 1994/12/16 16:11:26 winans
* Added debug flag guards to ALL printing. The default debug level is set
* to 1 -- this provides the same output as the old version.
*
* Revision 1.35 1994/12/12 16:02:57 winans
* Rewrote the init code so that it always returns a zero (don't kill the
* startup.cmd file.) It is possible that this could cause some confusion
@@ -2459,10 +2463,13 @@ STATIC int pepTxTask(int link)
/* Send the message in polled mode */
txTCount = pnode->txMsg.length;
/* BUG -- would be nice if we verify the length >6 here */
txCCount = 0;
txMsg = &(pnode->txMsg.length);
while ((txCCount < txTCount) && (pBBLink[link]->abortFlag == 0)) {
while ((txCCount < txTCount -1) && (pBBLink[link]->abortFlag == 0)) {
stuck = 1000;
while (((pBBLink[link]->l.PepLink.bbRegs->stat_ctl & PEP_BB_TFNF)
@@ -2487,12 +2494,13 @@ STATIC int pepTxTask(int link)
if (bbDebug>30)
printf("pepTxTask(%d): outputting %2.2X\n",link,0x00);
pBBLink[link]->l.PepLink.bbRegs->data = 0x00;
}
else if (txCCount == (txTCount -1)) { /* last byte of package */
#if 0
} else if (txCCount == (txTCount -1)) { /* last byte of package */
pBBLink[link]->l.PepLink.bbRegs->stat_ctl = *txMsg;
if (bbDebug>30)
printf("pepTxTask(%d): outputting last byte %2.2X\n",
link,*txMsg);
#endif
} else { /* regular ol' message byte */
pBBLink[link]->l.PepLink.bbRegs->data = *txMsg;
if (bbDebug>30)
@@ -2536,6 +2544,11 @@ STATIC int pepTxTask(int link)
{
/* Lock the busy list */
semTake(pBBLink[link]->busyList.sem, WAIT_FOREVER);
pBBLink[link]->l.PepLink.bbRegs->stat_ctl = *txMsg;
if (bbDebug>30)
printf("pepTxTask(%d): outputting last byte %2.2X\n",
link,*txMsg);
/* set the retire time */
pnode->retire = tickGet();

View File

@@ -62,6 +62,12 @@
*
*
* $Log$
* Revision 1.27 1994/12/14 22:29:14 winans
* Removed DMAC command chaining structure(s) from the ibLink
* structure so they can be malloc'd seperately. This keeps
* the usage of A24 space restricted to ONLY those structures
* that have to be there.
*
* Revision 1.26 1994/12/12 16:03:00 winans
* Rewrote the init code so that it always returns a zero (don't kill the
* startup.cmd file.) It is possible that this could cause some confusion
@@ -151,11 +157,11 @@ STATIC char *ram_base; /* Base of the ram on the CPU board */
STATIC int timeoutSquelch = 0; /* Used to quiet timeout msgs during polling */
/* DMA timing bus error problem debugging in niPhysIo */
int ibDmaDebug = 0; /* Turns on DMA debug messages from this driver */
int ibDmaTimingError = 0; /* count "bad memProbes"/call of niPhysIo */
int ibDmaTimingErrorTotal = 0; /* count total "bad memProbes" in niPhysIo */
int ibDmaMaxError = 0 ; /* max # bad calls per call of niPhysIo */
STATIC char testWrite; /* test char to write to 1014 card */
int ibDmaDebug = 0; /* Turns on DMA debug messages from this driver */
int ibDmaTimingError = 0; /* count "bad memProbes"/call of niPhysIo */
int ibDmaTimingErrorTotal = 0; /* count total "bad memProbes" in niPhysIo */
int ibDmaMaxError = 0; /* max # bad calls per call of niPhysIo */
STATIC char testWrite; /* test char to write to 1014 card */
/******************************************************************************
@@ -221,12 +227,7 @@ struct niLink {
WDOG_ID watchDogId; /* watchdog for timeouts */
struct ibregs *ibregs;/* pointer to board registers */
#if 0
char cc_byte;
struct cc_ary cc_array;
#else
DmaStuffStruct *DmaStuff;
#endif
char r_isr1;
char r_isr2;
@@ -1094,6 +1095,7 @@ int time; /* time to wait on the DMA operation */
else
b->ch1.ccr = D_EINT;
#ifdef INCLUDE_LANL_DMA_TIMING_CHECKER
/*************************************************************************
* DMAC BUS ERROR CATCH
* The following lines are included because of a possible VME protocol
@@ -1115,9 +1117,11 @@ int time; /* time to wait on the DMA operation */
logMsg("DMA timing: error = %d, total = %d, max = %d\n",
ibDmaTimingError, ibDmaTimingErrorTotal, ibDmaMaxError);
/***************************************************************************/
#endif
b->ch0.ccr = D_SRT;
#ifdef INCLUDE_LANL_DMA_TIMING_CHECKER
/****************************
* DMAC BUS ERROR CATCH
*****************************/
@@ -1131,6 +1135,7 @@ int time; /* time to wait on the DMA operation */
logMsg("DMA timing: error = %d, total = %d, max = %d\n",
ibDmaTimingError, ibDmaTimingErrorTotal, ibDmaMaxError);
/***************************************************************************/
#endif
b->imr2 = w_imr2; /* this must be done last */
@@ -2041,102 +2046,6 @@ int length; /* number of bytes to write out from the data buffer */
return(ERROR);
}
#ifdef INCLUDE_HIDEOS_INTERFACE
/******************************************************************************
*
* Interface functions for HiDEOS access.
*
******************************************************************************/
/******************************************************************************
*
* Read up to <length> bytes into <*buffer>.
*
******************************************************************************/
STATIC int
HideosGpibRead(struct ibLink *pibLink, int device, char *buffer, int length, int time)
{
logMsg("HideosGpibRead() entered\n");
return(bytes read | error);
}
/******************************************************************************
*
* Write <length> bytes from <*buffer> in data mode.
*
******************************************************************************/
STATIC int
HideosGpibWrite(struct ibLink *pibLink, int device, char *buffer, int length, int time)
{
logMsg("HideosGpibWrite() entered\n");
return(bytes sent | error);
}
/******************************************************************************
*
* Write <length> bytes from <*buffer> in command mode.
*
******************************************************************************/
STATIC int
HideosGpibCmd(struct ibLink *pibLink, char *buffer, int length)
{
logMsg("HideosGpibCmd() entered\n");
return(bytes sent | error);
}
/******************************************************************************
*
* Verify that the given GPIB port exists.
*
******************************************************************************/
STATIC int
HideosGpibCheckLink(int link, int bug)
{
logMsg("HideosGpibCheckLink() entered\n");
return(OK | ERROR);
}
/******************************************************************************
*
* Prevent SRQs from being polled on a given GPIB port.
*
******************************************************************************/
STATIC int
HideosGpibSrqPollInhibit(int link, int bug, int gpibAddr)
{
logMsg("HideosGpibSrqPollInhibit() entered -- NOT SUPPORTED YET\n");
return(ERROR);
}
/******************************************************************************
*
* Generate a GPIB link for a HiDEOS port.
*
******************************************************************************/
STATIC int
HideosGpibGenLink(int link, int bug)
{
logMsg("HideosGpibGenLink() entered\n");
return(ibLinkStart() | ERROR);
}
/******************************************************************************
*
* Handle a GPIB IOCTL call.
*
******************************************************************************/
STATIC int
HideosGpibIoctl(int link, int bug, int cmd, int v, caddr_t p)
{
logMsg("HideosGpibIoctl() entered\n");
return(OK | ERROR);
}
/******************************************************************************
*
* Given the port information, return a link structure.
*
******************************************************************************/
struct bbIbLink *
HideosGpibFindLink(int link, int bug)
{
logMsg("HideosGpibFindLink() entered\n");
return(bbIbLink* | NULL);
}
#endif
/******************************************************************************
*
* These are the BitBus architecture specific functions.
@@ -2674,9 +2583,9 @@ IBHistDump(int type, int link, int bug)
}
#endif
#if 1
#if 0
/* A way to stop the CPU when idle... run from shell at prio 250 */
BigFFT()
cpuStopperThingy()
{
while (1)
asm(" stop #0x3000");

View File

@@ -4,22 +4,44 @@ include $(EPICS)/config/CONFIG_BASE
USR_CFLAGS = -D_NO_PROTO
SRCS.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
SRCS.c += ../bucketLib.c
SRCS.c += ../calcPerform.c
SRCS.c += ../cvtFast.c
SRCS.c += ../ellLib.c
SRCS.c += ../envSubr.c
SRCS.c += ../errInc.c
SRCS.c += ../errMtst.c
SRCS.c += ../errPrintfUNIX.c
SRCS.c += ../errSymLib.c
SRCS.c += errSymTbl.c
SRCS.c += ../fdmgr.c
SRCS.c += ../freeListLib.c
SRCS.c += ../gpHashLib.c
SRCS.c += ../memDebugLib.c
SRCS.c += ../nextFieldSubr.c
SRCS.c += ../postfix.c
SRCS.c += ../realpath.c
SRCS.c += ../tsSubr.c
SRCS.c += ../assertUNIX.c
LIBOBJS = \
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
LIBOBJS += bucketLib.o
LIBOBJS += calcPerform.o
LIBOBJS += cvtFast.o
LIBOBJS += ellLib.o
LIBOBJS += envSubr.o
LIBOBJS += errMtst.o
LIBOBJS += errPrintfUNIX.o
LIBOBJS += errSymLib.o
LIBOBJS += errSymTbl.o
LIBOBJS += fdmgr.o
LIBOBJS += freeListLib.o
LIBOBJS += gpHashLib.o
LIBOBJS += memDebugLib.o
LIBOBJS += nextFieldSubr.o
LIBOBJS += postfix.o
LIBOBJS += realpath.o
LIBOBJS += tsSubr.o
LIBOBJS += assertUNIX.o
LIBNAME = libCom.a

View File

@@ -2,21 +2,42 @@ EPICS = ../../../..
include Target.include
include $(EPICS)/config/CONFIG_BASE
SRCS.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 ../mprintf.c errSymTbl.c
OBJS = \
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
SRCS.c += ../calcPerform.c
SRCS.c += ../cvtBpt.c
SRCS.c += ../cvtFast.c
SRCS.c += ../gpHashLib.c
SRCS.c += ../freeListLib.c
SRCS.c += ../ellLib.c
SRCS.c += ../envSubr.c
SRCS.c += ../errSymLib.c
SRCS.c += ../nextFieldSubr.c
SRCS.c += ../postfix.c
SRCS.c += ../bucketLib.c
SRCS.c += ../memDebugLib.c
SRCS.c += ../tsSubr.c
SRCS.c += ../pal.c
SRCS.c += ../paldef.c
SRCS.c += errSymTbl.c
SRCS.c += ../errPrintfVX.c
SRCS.c += ../assertVX.c
OBJS += calcPerform.o
OBJS += cvtBpt.o
OBJS += cvtFast.o
OBJS += ellLib.o
OBJS += envSubr.o
OBJS += errSymLib.o
OBJS += errSymTbl.o
OBJS += nextFieldSubr.o
OBJS += postfix.o
OBJS += bucketLib.o
OBJS += tsSubr.o
OBJS += gpHashLib.o
OBJS += freeListLib.o
OBJS += pal.o
OBJS += paldef.o
OBJS += errPrintfVX.o
OBJS += assertVX.o
PROD = libCom

65
src/libCom/assertUNIX.c Normal file
View File

@@ -0,0 +1,65 @@
/* $Id$
* assertUNIX.c
* Author: Jeffrey Hill
* Date: 02-27-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
*
* Modification Log:
* -----------------
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <epicsAssert.h>
#include <epicsPrint.h>
/*
* epicsAssert ()
*/
void epicsAssert (const char *pFile, const unsigned line, const char *pMsg)
{
epicsPrintf (
"\n\n\nA call to \"assert (%s)\" failed in %s line %d.\n", pMsg, pFile, line);
epicsPrintf (
"The file \"core\" will be created in the current working directory.\n");
epicsPrintf (
"Please save this file and the text of this message in order to assist\n");
epicsPrintf (
"in diagnosing this problem.\n");
epicsPrintf (
"Please contact the author of this software or else send the text of\n");
epicsPrintf (
"this message to \"tech_talk@aps.anl.gov\"\n");
abort ();
}

71
src/libCom/assertVX.c Normal file
View File

@@ -0,0 +1,71 @@
/* $Id$
* assertVX.c
* Author: Jeff Hill
* Date: 02-27-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
*
* Modification Log:
* -----------------
***************************************************************************
*/
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#include <vxWorks.h>
#include <taskLib.h>
#include <epicsAssert.h>
#include <epicsPrint.h>
/*
* epicsAssert ()
*
* This forces assert failures into the log file and then
* calls taskSuspend() instead of exit() so that we can debug
* the problem.
*/
void epicsAssert (const char *pFile, const unsigned line, const char *pMsg)
{
int taskId = taskIdSelf();
epicsPrintf (
"\n\n\n%s: A call to \"assert (%s)\" failed in %s at %d\n",
taskName (taskId),
pMsg,
pFile,
line);
epicsPrintf (
"Please send a copy of the output from \"tt (0x%x)\" and a copy of this message\n",
taskId);
epicsPrintf (
"to the author or \"tech_talk@aps.anl.gov\"\n");
taskSuspend (taskId);
}

View File

@@ -35,12 +35,12 @@
*/
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <epicsAssert.h>
#include <bucketLib.h>
#ifndef NBBY

View File

@@ -35,12 +35,12 @@
*/
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <epicsAssert.h>
#include <bucketLib.h>
#ifndef NBBY

View File

@@ -48,6 +48,10 @@
* Also they are not used on vxWorks
*/
#ifdef vxWorks
#include <vxWorks.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <limits.h> /* XPG2/XPG3/POSIX.1/FIPS151-1/ANSI-C */

View File

@@ -48,6 +48,10 @@
* Also they are not used on vxWorks
*/
#ifdef vxWorks
#include <vxWorks.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <limits.h> /* XPG2/XPG3/POSIX.1/FIPS151-1/ANSI-C */

View File

@@ -32,6 +32,10 @@
/* #define DEBUG_DRIVER */
#ifdef vxWorks
#include <vxWorks.h>
#endif
#include <stdlib.h>
#include <ellLib.h>

View File

@@ -32,6 +32,10 @@
/* #define DEBUG_DRIVER */
#ifdef vxWorks
#include <vxWorks.h>
#endif
#include <stdlib.h>
#include <ellLib.h>

View File

@@ -65,8 +65,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <netinet/in.h>
#ifdef _WINDOWS
# include <winsock.h>
#else
# include <sys/types.h>
# include <netinet/in.h>
#endif
#ifdef vxWorks
#include <inetLib.h>

View File

@@ -65,8 +65,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <netinet/in.h>
#ifdef _WINDOWS
# include <winsock.h>
#else
# include <sys/types.h>
# include <netinet/in.h>
#endif
#ifdef vxWorks
#include <inetLib.h>

View File

@@ -21,4 +21,4 @@
#include "errMdef.h"
#ifdef VXLIST
/* epics vxWorks only*/
#endif VXLIST
#endif /* VXLIST */

View File

@@ -0,0 +1,83 @@
/* $Id$
* errPrintfUNIX.c
* Author: Marty Kraimer
* Date: 02-16-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
*
* Modification Log: errPrintfUNIX.c
* -----------------
* .01 02-16-95 mrk Extracted from errSymLib.c
***************************************************************************
* This must ultimately be replaced by a facility that allows remote
* nodes access to the error messages. A message handling communication
* task should be written that allows multiple remote nodes to request
* notification of all error messages.
* For now lets just print messages and last errno via logMsg or printf
***************************************************************************
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <epicsAssert.h>
#include <dbDefs.h>
#include <errMdef.h>
#include <epicsPrint.h>
#include "errSymTbl.h"
/****************************************************************
* ERRMESSAGE - now a macro to call errPrintf
* ERRPRINTF - print an error symbol message
***************************************************************/
void errPrintf(long status, const char *pFileName,
int lineno, const char *pformat, ...)
{
va_list pvar;
va_start(pvar, pformat);
if(pFileName && errVerbose){
printf("filename=\"%s\" line number=%d\n", pFileName, lineno);
}
if(status==0) status = errno;
if(status>0) {
int rtnval;
unsigned short modnum,errnum;
char name[256];
rtnval = errSymFind(status,name);
modnum = status >> 16;
errnum = status & 0xffff;
if(rtnval) {
printf( "Error status (module %hu, number %hu) not in symbol table",
modnum, errnum);
} else {
printf("%s ",name);
}
}
vprintf(pformat,pvar);
printf("\n");
}

270
src/libCom/errPrintfVX.c Normal file
View File

@@ -0,0 +1,270 @@
/* $Id$
* errPrintfVX.c
* Author: Marty Kraimer and Jeff Hill
* Date: 6-1-90
*
* Experimental Physics and Industrial Control System (EPICS)
*
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
* Modification Log: errPrintfVX.c
* -----------------
* .01 02-16-95 mrk Extracted from errSymLib.c
***************************************************************************
*/
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#include <vxWorks.h>
#include <vxLib.h>
#include <taskLib.h>
#include <errnoLib.h>
#include <intLib.h>
#include <types.h>
#include <symLib.h>
#include <semLib.h>
#include <error.h>
#include <logLib.h>
#include <epicsAssert.h>
#include <ellLib.h>
#include <dbDefs.h>
#include <task_params.h>
#include <errMdef.h>
#include <epicsPrint.h>
#ifndef LOCAL
#define LOCAL static
#endif /* LOCAL */
static int mprintf (const char *pFormat, ...);
static int vmprintf (const char *pFormat, va_list pvar);
extern FILE *iocLogFile;
LOCAL SEM_ID clientWaitForTask;
LOCAL SEM_ID clientWaitForCompletion;
LOCAL SEM_ID serverWaitForWork;
LOCAL void epicsPrintTask(void);
LOCAL void errPrintfPVT(void);
typedef enum{cmdErrPrintf,cmdEpicsPrint} cmdType;
LOCAL struct {
cmdType cmd;
int taskid;
long status;
const char *pFileName;
int lineno;
const char *pformat;
va_list pvar;
int oldtaskid;
int printfStatus;
}pvtData;
LOCAL int errInitFlag=0;
void errInit(void)
{
if(!vxTas(&errInitFlag)) return;
pvtData.oldtaskid = 0;
if((clientWaitForTask=semBCreate(SEM_Q_FIFO,SEM_EMPTY))==NULL)
logMsg("semBcreate failed in errInit",0,0,0,0,0,0);
if((clientWaitForCompletion=semBCreate(SEM_Q_FIFO,SEM_EMPTY))==NULL)
logMsg("semBcreate failed in errInit",0,0,0,0,0,0);
if((serverWaitForWork=semBCreate(SEM_Q_FIFO,SEM_EMPTY))==NULL)
logMsg("semBcreate failed in errInit",0,0,0,0,0,0);
taskSpawn(EPICSPRINT_NAME,EPICSPRINT_PRI,EPICSPRINT_OPT,
EPICSPRINT_STACK,(FUNCPTR)epicsPrintTask,
0,0,0,0,0,0,0,0,0,0);
if ((errSymBld()) != 0) {
logMsg("errSymBld failed to initialize\n",0,0,0,0,0,0);
}
}
LOCAL void epicsPrintTask(void)
{
semGive(clientWaitForTask);
while(TRUE) {
if(semTake(serverWaitForWork,WAIT_FOREVER)!=OK)
logMsg("epicsPrint: semTake returned error\n",0,0,0,0,0,0);
switch(pvtData.cmd) {
case (cmdErrPrintf) :
errPrintfPVT();
break;
case (cmdEpicsPrint) :
pvtData.printfStatus = vmprintf(pvtData.pformat,pvtData.pvar);
break;
}
semGive(clientWaitForCompletion);
}
}
void errPrintf(long status, const char *pFileName,
int lineno, const char *pformat, ...)
{
va_list pvar;
if(INT_CONTEXT()) {
int logMsgArgs[6];
int i;
va_start (pvar, pformat);
for (i=0; i<NELEMENTS(logMsgArgs); i++) {
logMsgArgs[i] = va_arg(pvar, int);
}
logMsg ((char *)pformat,logMsgArgs[0],logMsgArgs[1],
logMsgArgs[2],logMsgArgs[3],logMsgArgs[4],
logMsgArgs[5]);
va_end (pvar);
return;
}
errInit();
va_start (pvar, pformat);
if(semTake(clientWaitForTask,WAIT_FOREVER)!=OK) {
logMsg("epicsPrint: semTake returned error\n",0,0,0,0,0,0);
taskSuspend(taskIdSelf());
}
pvtData.cmd = cmdErrPrintf;
pvtData.taskid = taskIdSelf();
pvtData.status = status;
pvtData.pFileName = pFileName;
pvtData.lineno = lineno;
pvtData.pformat = pformat;
pvtData.pvar = pvar;
semGive(serverWaitForWork);
if(semTake(clientWaitForCompletion,WAIT_FOREVER)!=OK) {
logMsg("epicsPrint: semTake returned error\n",0,0,0,0,0,0);
taskSuspend(taskIdSelf());
}
semGive(clientWaitForTask);
}
LOCAL void errPrintfPVT(void)
{
long status = pvtData.status;
const char *pFileName = pvtData.pFileName;
int lineno = pvtData.lineno;
const char *pformat = pvtData.pformat;
va_list pvar = pvtData.pvar;
if(pvtData.taskid != pvtData.oldtaskid) {
mprintf("task: 0X%x %s\n",pvtData.taskid,taskName(pvtData.taskid));
pvtData.oldtaskid = pvtData.taskid;
}
if(pFileName && errVerbose){
mprintf("filename=\"%s\" line number=%d\n", pFileName, lineno);
}
if(status==0) status = MYERRNO;
if(status>0) {
int rtnval;
unsigned short modnum,errnum;
char name[256];
rtnval = errSymFind(status,name);
modnum = status >> 16;
errnum = status & 0xffff;
if(rtnval) {
mprintf("Error status (module %hu, number %hu) not in symbol table\n",
modnum, errnum);
} else {
mprintf("%s ",name);
}
}
vmprintf(pformat,pvar);
mprintf("\n");
return;
}
int epicsPrintf(const char *pformat, ...)
{
va_list pvar;
va_start(pvar, pformat);
return epicsVprintf(pformat,pvar);
}
int epicsVprintf(const char *pformat, va_list pvar)
{
int status;
if(INT_CONTEXT()) {
int logMsgArgs[6];
int i;
for (i=0; i<NELEMENTS(logMsgArgs); i++) {
logMsgArgs[i] = va_arg(pvar, int);
}
status = logMsg ((char *)pformat,logMsgArgs[0],logMsgArgs[1],
logMsgArgs[2],logMsgArgs[3],logMsgArgs[4],
logMsgArgs[5]);
va_end (pvar);
return status;
}
errInit();
if(semTake(clientWaitForTask,WAIT_FOREVER)!=OK) {
logMsg("epicsPrint: semTake returned error\n",0,0,0,0,0,0);
taskSuspend(taskIdSelf());
}
pvtData.cmd = cmdEpicsPrint;
pvtData.pformat = pformat;
pvtData.pvar = pvar;
semGive(serverWaitForWork);
if(semTake(clientWaitForCompletion,WAIT_FOREVER)!=OK) {
logMsg("epicsPrint: semTake returned error\n",0,0,0,0,0,0);
taskSuspend(taskIdSelf());
}
status = pvtData.printfStatus;
semGive(clientWaitForTask);
return status;
}
LOCAL int mprintf (const char *pFormat, ...)
{
va_list pvar;
va_start (pvar, pFormat);
return vmprintf (pFormat, pvar);
}
LOCAL int vmprintf (const char *pFormat, va_list pvar)
{
int s0;
int s1;
s0 = vfprintf(stdout,pFormat,pvar);
fflush(stdout);
s1 = vfprintf(iocLogFile,pFormat,pvar);
fflush(iocLogFile);
va_end(pvar);
if (s1<0) {
return s1;
}
return s0;
}

View File

@@ -81,7 +81,6 @@
#include <symLib.h>
#include <errnoLib.h>
#include <mprintf.h>
extern SYMTAB_ID statSymTbl;
@@ -116,11 +115,6 @@ extern ERRSYMTAB_ID errSymTbl;
/*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
/****************************************************************
@@ -197,161 +191,6 @@ unsigned short errnum;
return((unsigned short)(((modnum - 500) * 20) + errnum) % NHASH);
}
/****************************************************************
* ERRMESSAGE - now a macro to call errPrintf
* ERRPRINTF - print an error symbol message
***************************************************************/
#ifdef __STDC__
void errPrintf(long status, char *pFileName, int lineno, char *pformat, ...)
#else
void errPrintf(va_alist)
va_dcl
#endif
{
va_list pvar;
static char *pReformat;
static int reformatSize;
static char pAdd[] = {'\n', '\0'};
#ifndef __STDC__
long status;
char *pformat;
char *pFileName;
int lineno;
#endif
#ifdef __STDC__
va_start(pvar, pformat);
#else
va_start(pvar);
status = va_arg(pvar, long);
pFileName = va_arg(pvar, char *);
lineno = va_arg(pvar, int);
pformat = va_arg(pvar, char *);
#endif
if(pFileName && errVerbose){
mprintf("filename=\"%s\" line number=%d\n", pFileName, lineno);
}
if (pformat != NULL) {
int size;
size = strlen(pformat)+NELEMENTS(pAdd);
if(reformatSize < size){
/*
* use a reasonable size string
*/
size = max(0xff, size);
if(pReformat){
free(pReformat);
}
pReformat = (char *) malloc(size);
if(pReformat){
reformatSize = size;
}
else{
mprintf ("%s: calloc error\n", __FILE__);
return;
}
}
strcpy(pReformat, pformat);
strcat(pReformat, pAdd);
}
verrPrintStatus(status, pReformat, pvar);
return;
}
/****************************************************************
* ERRPRINTSTATUS
***************************************************************/
#ifdef __STDC__
int errPrintStatus(long status, char *pFormat, ...)
#else
int errPrintStatus(va_alist)
va_dcl
#endif
{
va_list pvar;
#ifndef __STDC__
long status;
char *pFormat;
#endif
#ifdef __STDC__
va_start(pvar, pFormat);
#else
va_start(pvar);
status = va_arg(pvar, long);
pFormat = va_arg(pvar, char *);
#endif
return verrPrintStatus(status, pFormat, pvar);
}
/****************************************************************
* VERRPRINTSTATUS
***************************************************************/
#ifdef __STDC__
int verrPrintStatus(long status, char *pFormatString, va_list pvar)
#else
int verrPrintStatus(status, pFormatString, pvar)
long status;
char *pFormatString;
va_list pvar;
#endif
{
static char ctxToLarge[] = "** Context String Overflow **";
char name[256];
int rtnval;
int namelen;
int formatlen;
unsigned short modnum;
unsigned short errnum;
name[0] = '\0';
if(status==0) status = MYERRNO;
if(status >= -1){
rtnval = 0;
}
else {
rtnval = status;
}
if(status>0) {
rtnval = errSymFind(status,name);
modnum = status >> 16;
errnum = status & 0xffff;
if(rtnval) {
sprintf(name,
"Error status (module %hu, number %hu) not in symbol table",
modnum, errnum);
}
}
if(pFormatString){
namelen = strlen(name);
formatlen = strlen(pFormatString);
strcat(name," ");
if(sizeof(name)-namelen-1 > formatlen){
strcat(name, pFormatString);
}
else if(sizeof(name)-namelen-1 > sizeof(ctxToLarge)){
strcat(name, ctxToLarge);
}
else{
mprintf(ctxToLarge);
}
}
vmprintf(name, pvar);
return rtnval;
}
/****************************************************************
* ERRSYMBOLADD
* adds symbols to the master errnumlist as compiled from errSymTbl.c
@@ -389,11 +228,11 @@ int UnixSymFind(status, pname, pvalue)
{
if (status >= sys_nerr || status < 1) {
*pvalue = -1;
return;
return(0);
}
strcpy(pname, sys_errlist[status]);
*pvalue = status;
return;
return(0);
}
#endif
@@ -417,7 +256,7 @@ int ModSymFind(status, pname, pvalue)
modNum = (status >> 16);
if (modNum < 501) {
*pvalue = -1;
return;
return(0);
}
hashInd = errhash(status);
phashnode = (ERRNUMNODE**)&hashtable[hashInd];
@@ -426,14 +265,14 @@ int ModSymFind(status, pname, pvalue)
if (pNextNode->errNum == status) {
strcpy(pname, pNextNode->message);
*pvalue = status;
return;
return(0);
}
phashnode = &pNextNode->hashnode;
pNextNode = *phashnode;
}
*pname = 0;
*pvalue = -1;
return ;
return(0);
}
/****************************************************************

View File

@@ -81,7 +81,6 @@
#include <symLib.h>
#include <errnoLib.h>
#include <mprintf.h>
extern SYMTAB_ID statSymTbl;
@@ -116,11 +115,6 @@ extern ERRSYMTAB_ID errSymTbl;
/*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
/****************************************************************
@@ -197,161 +191,6 @@ unsigned short errnum;
return((unsigned short)(((modnum - 500) * 20) + errnum) % NHASH);
}
/****************************************************************
* ERRMESSAGE - now a macro to call errPrintf
* ERRPRINTF - print an error symbol message
***************************************************************/
#ifdef __STDC__
void errPrintf(long status, char *pFileName, int lineno, char *pformat, ...)
#else
void errPrintf(va_alist)
va_dcl
#endif
{
va_list pvar;
static char *pReformat;
static int reformatSize;
static char pAdd[] = {'\n', '\0'};
#ifndef __STDC__
long status;
char *pformat;
char *pFileName;
int lineno;
#endif
#ifdef __STDC__
va_start(pvar, pformat);
#else
va_start(pvar);
status = va_arg(pvar, long);
pFileName = va_arg(pvar, char *);
lineno = va_arg(pvar, int);
pformat = va_arg(pvar, char *);
#endif
if(pFileName && errVerbose){
mprintf("filename=\"%s\" line number=%d\n", pFileName, lineno);
}
if (pformat != NULL) {
int size;
size = strlen(pformat)+NELEMENTS(pAdd);
if(reformatSize < size){
/*
* use a reasonable size string
*/
size = max(0xff, size);
if(pReformat){
free(pReformat);
}
pReformat = (char *) malloc(size);
if(pReformat){
reformatSize = size;
}
else{
mprintf ("%s: calloc error\n", __FILE__);
return;
}
}
strcpy(pReformat, pformat);
strcat(pReformat, pAdd);
}
verrPrintStatus(status, pReformat, pvar);
return;
}
/****************************************************************
* ERRPRINTSTATUS
***************************************************************/
#ifdef __STDC__
int errPrintStatus(long status, char *pFormat, ...)
#else
int errPrintStatus(va_alist)
va_dcl
#endif
{
va_list pvar;
#ifndef __STDC__
long status;
char *pFormat;
#endif
#ifdef __STDC__
va_start(pvar, pFormat);
#else
va_start(pvar);
status = va_arg(pvar, long);
pFormat = va_arg(pvar, char *);
#endif
return verrPrintStatus(status, pFormat, pvar);
}
/****************************************************************
* VERRPRINTSTATUS
***************************************************************/
#ifdef __STDC__
int verrPrintStatus(long status, char *pFormatString, va_list pvar)
#else
int verrPrintStatus(status, pFormatString, pvar)
long status;
char *pFormatString;
va_list pvar;
#endif
{
static char ctxToLarge[] = "** Context String Overflow **";
char name[256];
int rtnval;
int namelen;
int formatlen;
unsigned short modnum;
unsigned short errnum;
name[0] = '\0';
if(status==0) status = MYERRNO;
if(status >= -1){
rtnval = 0;
}
else {
rtnval = status;
}
if(status>0) {
rtnval = errSymFind(status,name);
modnum = status >> 16;
errnum = status & 0xffff;
if(rtnval) {
sprintf(name,
"Error status (module %hu, number %hu) not in symbol table",
modnum, errnum);
}
}
if(pFormatString){
namelen = strlen(name);
formatlen = strlen(pFormatString);
strcat(name," ");
if(sizeof(name)-namelen-1 > formatlen){
strcat(name, pFormatString);
}
else if(sizeof(name)-namelen-1 > sizeof(ctxToLarge)){
strcat(name, ctxToLarge);
}
else{
mprintf(ctxToLarge);
}
}
vmprintf(name, pvar);
return rtnval;
}
/****************************************************************
* ERRSYMBOLADD
* adds symbols to the master errnumlist as compiled from errSymTbl.c
@@ -389,11 +228,11 @@ int UnixSymFind(status, pname, pvalue)
{
if (status >= sys_nerr || status < 1) {
*pvalue = -1;
return;
return(0);
}
strcpy(pname, sys_errlist[status]);
*pvalue = status;
return;
return(0);
}
#endif
@@ -417,7 +256,7 @@ int ModSymFind(status, pname, pvalue)
modNum = (status >> 16);
if (modNum < 501) {
*pvalue = -1;
return;
return(0);
}
hashInd = errhash(status);
phashnode = (ERRNUMNODE**)&hashtable[hashInd];
@@ -426,14 +265,14 @@ int ModSymFind(status, pname, pvalue)
if (pNextNode->errNum == status) {
strcpy(pname, pNextNode->message);
*pvalue = status;
return;
return(0);
}
phashnode = &pNextNode->hashnode;
pNextNode = *phashnode;
}
*pname = 0;
*pvalue = -1;
return ;
return(0);
}
/****************************************************************

View File

@@ -62,6 +62,10 @@
* if we are in fdmgr_pend_event()
* .15 joh 011993 Created fdmgr header file
* .16 joh 011993 Converted to ANSI C
* .17 joh 030895 More ANSI C changes and fixed lost send callback
* problem (send call back discarded when fdmgr pend
* event time out expires even if the send call back
* has not been called at least once).
*
* NOTES:
*
@@ -95,9 +99,10 @@ static char *pSccsId = "@(#) $Id$";
* ANSI
*/
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <errno.h>
#ifdef vxWorks
#include <vxWorks.h>
@@ -108,6 +113,7 @@ static char *pSccsId = "@(#) $Id$";
#include <selectLib.h>
#endif
#include <epicsAssert.h>
#include <fdmgr.h>
#ifndef TRUE
@@ -182,9 +188,7 @@ fdctx *pfdctx,
struct timeval *pt
);
LOCAL void select_alarm(
fdctx *pfdctx
);
LOCAL void select_alarm(void *pParam);
LOCAL int fdmgr_select(
fdctx *pfdctx,
@@ -269,7 +273,7 @@ int fdmgr_delete(fdctx *pfdctx)
fdmgrAlarm *fdmgr_add_timeout(
fdctx *pfdctx,
struct timeval *ptimeout,
void (*func)(),
void (*func)(void *),
void *param
)
{
@@ -330,10 +334,10 @@ void *param
}
}
if(pa){
ellInsert(&pfdctx->alarm_list, pa->node.previous, (ELLNODE*)palarm);
ellInsert(&pfdctx->alarm_list, pa->node.previous, &palarm->node);
}
else{
ellAdd(&pfdctx->alarm_list,(ELLNODE*) palarm);
ellAdd(&pfdctx->alarm_list, &palarm->node);
}
palarm->alt = alt_alarm;
UNLOCK(pfdctx);
@@ -360,8 +364,8 @@ fdmgrAlarm *palarm
LOCK(pfdctx);
alt = palarm->alt;
if(alt == alt_alarm){
ellDelete(&pfdctx->alarm_list, (ELLNODE*)palarm);
ellAdd(&pfdctx->free_alarm_list, (ELLNODE*)palarm);
ellDelete(&pfdctx->alarm_list, &palarm->node);
ellAdd(&pfdctx->free_alarm_list, &palarm->node);
palarm->alt = alt_free;
status = OK;
}
@@ -423,7 +427,7 @@ fdmgrAlarm *palarm
int fdmgr_add_fd(
fdctx *pfdctx,
int fd,
void (*pfunc)(),
void (*pfunc)(void *),
void *param
)
{
@@ -449,7 +453,7 @@ int fdmgr_add_callback(
fdctx *pfdctx,
int fd,
enum fdi_type fdi,
void (*pfunc)(),
void (*pfunc)(void *),
void *param
)
{
@@ -495,7 +499,7 @@ void *param
pfdentry->delete_pending = FALSE;
LOCK(pfdctx);
ellAdd(&pfdctx->fdentry_list, (ELLNODE*)pfdentry);
ellAdd(&pfdctx->fdentry_list, &pfdentry->node);
UNLOCK(pfdctx);
return OK;
@@ -542,7 +546,7 @@ enum fdi_type fdi
pfdentry = (fdentry *) pfdentry->node.next){
if(pfdentry->fd == fd && pfdentry->fdi == fdi){
ellDelete(&pfdctx->fdentry_list, (ELLNODE*)pfdentry);
ellDelete(&pfdctx->fdentry_list, &pfdentry->node);
fdmgr_finish_off_fdentry(pfdctx, pfdentry);
status = OK;
break;
@@ -603,7 +607,7 @@ register fdentry *pfdentry
)
{
FD_CLR(pfdentry->fd, pfdentry->pfds);
ellAdd(&pfdctx->fdentry_free_list, (ELLNODE*)pfdentry);
ellAdd(&pfdctx->fdentry_free_list, &pfdentry->node);
}
@@ -618,9 +622,8 @@ struct timeval *ptimeout
)
{
int status;
extern errno;
struct timeval t;
fdmgrAlarm *palarm;
fdmgrAlarm *palarm;
lockFDMGRPendEvent(pfdctx);
@@ -707,12 +710,21 @@ struct timeval *ptimeout
# ifdef vxWorks
taskSafe();
# endif
# if defined (__hpux)
status = select(
pfdctx->maxfd,
(int *)&pfdctx->readch,
(int *)&pfdctx->writech,
(int *)&pfdctx->excpch,
ptimeout);
# else
status = select(
pfdctx->maxfd,
&pfdctx->readch,
&pfdctx->writech,
&pfdctx->excpch,
ptimeout);
# endif
# ifdef vxWorks
taskUnsafe();
# endif
@@ -730,8 +742,8 @@ struct timeval *ptimeout
ptimeout->tv_usec);
else
fdmgrPrintf(
"fdmgr: error from select %d\n",
errno);
"fdmgr: error from select %s\n",
strerror(errno));
return labor_performed;
}
@@ -742,14 +754,14 @@ struct timeval *ptimeout
LOCK(pfdctx)
pfdentry = (fdentry *) pfdentry->node.next;
if(pfdentry){
ellDelete(&pfdctx->fdentry_list, (ELLNODE*)pfdentry);
ellDelete(&pfdctx->fdentry_list, &pfdentry->node);
/*
*
* holding place where it can be marked
* pending delete but not deleted
*
*/
ellAdd(&pfdctx->fdentry_in_use_list, (ELLNODE*)pfdentry);
ellAdd(&pfdctx->fdentry_in_use_list, &pfdentry->node);
}
UNLOCK(pfdctx)
@@ -774,26 +786,29 @@ struct timeval *ptimeout
*/
if(!pfdentry->delete_pending){
(*pfdentry->pfunc)(pfdentry->param);
/*
* writes are one shots
*/
if (pfdentry->fdi==fdi_write) {
pfdentry->delete_pending = TRUE;
}
labor_performed = TRUE;
}
UNLOCK_FD_HANDLER(pfdctx);
}
LOCK(pfdctx)
ellDelete(&pfdctx->fdentry_in_use_list, (ELLNODE*)pfdentry);
ellDelete(&pfdctx->fdentry_in_use_list, &pfdentry->node);
/*
* if it is marked pending delete
* reset it and place it on the free list
*
* write fd interest is treated as a one shot
* so remove them after each action
*/
if(pfdentry->delete_pending || pfdentry->fdi==fdi_write){
if(pfdentry->delete_pending){
fdmgr_finish_off_fdentry(pfdctx, pfdentry);
}
else{
ellAdd(&pfdctx->fdentry_list, (ELLNODE*)pfdentry);
ellAdd(&pfdctx->fdentry_list, &pfdentry->node);
}
UNLOCK(pfdctx)
@@ -818,8 +833,8 @@ struct timeval *poffset
{
struct timeval t;
int status;
fdmgrAlarm *pa;
fdmgrAlarm *nextpa;
fdmgrAlarm *pa;
fdmgrAlarm *nextpa;
status = fdmgr_gettimeval(pfdctx, &t);
assert (status >= 0);
@@ -832,9 +847,9 @@ struct timeval *poffset
if(pa->t.tv_usec > t.tv_usec)
break;
nextpa = (fdmgrAlarm*)pa->node.next;
ellDelete(&pfdctx->alarm_list, (ELLNODE*)pa);
ellAdd(&pfdctx->expired_alarm_list, (ELLNODE*)pa);
nextpa = (fdmgrAlarm*) pa->node.next;
ellDelete(&pfdctx->alarm_list, &pa->node);
ellAdd(&pfdctx->expired_alarm_list, &pa->node);
pa->alt = alt_expired;
}
UNLOCK(pfdctx);
@@ -914,10 +929,10 @@ struct timeval *poffset
* select_alarm()
*
*/
LOCAL void select_alarm(
fdctx *pfdctx
)
LOCAL void select_alarm(void *pParam)
{
fdctx *pfdctx = pParam;
pfdctx->select_tmo = TRUE;
}

View File

@@ -51,6 +51,10 @@ DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000).
* .01 04-19-94 mrk Initial Implementation
*/
#ifdef vxWorks
#include <vxWorks.h>
#endif
#include <string.h>
#include <stdlib.h>
#include <stddef.h>

View File

@@ -51,6 +51,10 @@ DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000).
* .01 04-19-94 mrk Initial Implementation
*/
#ifdef vxWorks
#include <vxWorks.h>
#endif
#include <string.h>
#include <stdlib.h>
#include <stddef.h>

View File

@@ -51,6 +51,10 @@ DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000).
* .01 04-07-94 mrk Initial Implementation
*/
#ifdef vxWorks
#include <vxWorks.h>
#endif
#include <dbDefs.h>
#include <string.h>
#include <stdlib.h>

View File

@@ -51,6 +51,10 @@ DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000).
* .01 04-07-94 mrk Initial Implementation
*/
#ifdef vxWorks
#include <vxWorks.h>
#endif
#include <dbDefs.h>
#include <string.h>
#include <stdlib.h>

View File

@@ -30,8 +30,10 @@
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <time.h>
#include <epicsAssert.h>
#include <ellLib.h>
#ifdef vxWorks

View File

@@ -140,7 +140,7 @@
# include <ctype.h>
# include <stdio.h>
#endif
#include <assert.h>
#include <epicsAssert.h>
/*-----------------------------------------------------------------------------
* the preamble skips over leading white space, stopping either at

151
src/libCom/sun4ansi.c Normal file
View File

@@ -0,0 +1,151 @@
/* $Id$ */
/*
* To get strtoul and strerror a sunos system must have
* /usr/lang/SC2.0.1patch installed. See CONFIG_SITE.Unix.sun4.
* Andrew Johnson has created this file named sun4ansi.c containg code
* for strtoul and strerror which is available in the base/libCom
* directory so that any site that needs it can add it to the Makefile.Unix.
*/
#ifdef SUNOS4
/*
* $Log$
* Revision 1.1 1995/02/17 15:09:56 jba
* Initial version
*
* Revision 1.1 1995/01/11 10:34:21 anj
* Added sun4ansi.c for those without sun4 ACC.
*
*
*
* Routines which are needed but SunOS 4.x doesn't provide.
* These definitions obtained from GNU libiberty directory.
* Note that Sun's Ansi C compiler provides these routines,
* so there ought to be a way of excluding this file if you
* have that...
*
*/
/*
* strtol : convert a string to long.
*
* Andy Wilson, 2-Oct-89.
*/
#include <errno.h>
#include <ctype.h>
#include <stdio.h>
#include <limits.h>
extern int errno;
extern int sys_nerr;
extern char *sys_errlist[];
unsigned long
strtoul(const char *s, char **ptr, int base)
{
unsigned long total = 0, tmp = 0;
unsigned digit;
const char *start=s;
int did_conversion=0;
int negate = 0;
if (s==NULL)
{
errno = ERANGE;
if (!ptr)
*ptr = (char *)start;
return 0L;
}
while (isspace(*s))
s++;
if (*s == '+')
s++;
else if (*s == '-')
s++, negate = 1;
if (base==0 || base==16) /* the 'base==16' is for handling 0x */
{
/*
* try to infer base from the string
*/
if (*s != '0')
tmp = 10; /* doesn't start with 0 - assume decimal */
else if (s[1] == 'X' || s[1] == 'x')
tmp = 16, s += 2; /* starts with 0x or 0X - hence hex */
else
tmp = 8; /* starts with 0 - hence octal */
if (base==0)
base = (int)tmp;
}
while ( digit = *s )
{
if (digit >= '0' && digit < ('0'+base))
digit -= '0';
else
if (base > 10)
{
if (digit >= 'a' && digit < ('a'+(base-10)))
digit = digit - 'a' + 10;
else if (digit >= 'A' && digit < ('A'+(base-10)))
digit = digit - 'A' + 10;
else
break;
}
else
break;
did_conversion = 1;
tmp = (total * base) + digit;
if (tmp < total) /* check overflow */
{
errno = ERANGE;
if (ptr != NULL)
*ptr = (char *)s;
return (ULONG_MAX);
}
total = tmp;
s++;
}
if (ptr != NULL)
*ptr = (char *) ((did_conversion) ? (char *)s : (char *)start);
return negate ? -total : total;
}
/*
* strerror
*
* convert an error number into a string
*/
char *
strerror (errnoval)
int errnoval;
{
char *msg;
static char buf[32];
if ((errnoval < 0) || (errnoval >= sys_nerr))
{
/* Out of range, just return NULL */
msg = NULL;
}
else if ((sys_errlist == NULL) || (sys_errlist[errnoval] == NULL))
{
/* In range, but no sys_errlist or no entry at this index. */
sprintf (buf, "Error %d", errnoval);
msg = buf;
}
else
{
/* In range, and a valid message. Just return the message. */
msg = sys_errlist[errnoval];
}
return (msg);
}
#endif

View File

@@ -38,6 +38,8 @@
* 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
* .12 02-24-95 joh fixed TScurrentTimeStamp() => tsLocalTime ()
* return status mapping prob introduced by .09 above
*
* make options
* -DvxWorks makes a version for VxWorks
@@ -128,7 +130,7 @@
#endif
#endif
# include <assert.h>
#include <epicsAssert.h>
#include <envDefs.h>
#define TS_PRIVATE_DATA
@@ -593,30 +595,30 @@ long
tsLocalTime(pStamp)
TS_STAMP *pStamp; /* O pointer to time stamp buffer */
{
long retStat=S_ts_OK;/* return status to caller */
long retStat=S_ts_OK;/* return status to caller */
#ifdef vxWorks
# if 0 /* 'test' code, for ioc core without time of day service */
assert(pStamp != NULL);
pStamp->nsec = 987000000;
pStamp->secPastEpoch = 30 * 86400 + 495; /* 0815 Jan 31 of epoch year */
# else
return TScurrentTimeStamp((struct timespec*)pStamp);
# endif
retStat = TScurrentTimeStamp((struct timespec*)pStamp);
if (retStat == 0) {
return S_ts_OK;
}
else {
return S_ts_sysTimeError;
}
#else
struct timeval curtime;
struct timeval curtime;
assert(pStamp != NULL);
if (gettimeofday(&curtime, (struct timezone *)NULL) == -1)
retStat = S_ts_sysTimeError;
else {
pStamp->nsec = ( curtime.tv_usec/1000 ) * 1000000;
pStamp->secPastEpoch = curtime.tv_sec - TS_EPOCH_SEC_PAST_1970;
}
assert(pStamp != NULL);
if (gettimeofday(&curtime, (struct timezone *)NULL) == -1)
retStat = S_ts_sysTimeError;
else {
pStamp->nsec = ( curtime.tv_usec/1000 ) * 1000000;
pStamp->secPastEpoch = curtime.tv_sec - TS_EPOCH_SEC_PAST_1970;
}
#endif
pStamp->nsec = pStamp->nsec - (pStamp->nsec % TS_TRUNC);
return retStat;
pStamp->nsec = pStamp->nsec - (pStamp->nsec % TS_TRUNC);
return retStat;
}
/*+/subr**********************************************************************

View File

@@ -9,6 +9,7 @@
*
* .01 010393 Applied fix for zero C ISR param causes incorrect
* identification as MACRO ISR problem.
* .02 022195 Compiler warnings fixed
*/
/*
@@ -156,17 +157,17 @@ int cISRTest(FUNCPTR proutine, FUNCPTR *ppisr, void **pparam)
pchk++, pref++){
status = vxMemProbe(
pchk,
(char *) pchk,
READ,
sizeof(val),
&val);
(char *) &val);
if(status < 0){
return ERROR;
}
if(val != *pref){
if(*pref == (unsigned char) ISR_PATTERN){
*ppisr = fetch_pointer(pchk);
*ppisr = (FUNCPTR) fetch_pointer(pchk);
pref += sizeof(*ppisr)-1;
pchk += sizeof(*ppisr)-1;
found_isr = TRUE;

View File

@@ -4,98 +4,93 @@ include $(EPICS)/config/CONFIG_BASE
USR_INCLUDES = -I../../drv
SRCS.c = \
../recAi.c\
../recAo.c\
../recBi.c\
../recBo.c\
../recCalc.c\
../recCompress.c\
../recDfanout.c\
../recEg.c\
../recEgevent.c\
../recEr.c\
../recErevent.c\
../recEvent.c\
../recFanout.c\
../recHistogram.c\
../recLongin.c\
../recLongout.c\
../recMbbi.c\
../recMbbiDirect.c\
../recMbbo.c\
../recMbboDirect.c\
../recPermissive.c\
../recPid.c\
../recPulseCounter.c\
../recPulseDelay.c\
../recPulseTrain.c\
../recScan.c\
../recSel.c\
../recSeq.c\
../recState.c\
../recSteppermotor.c\
../recStringin.c\
../recStringout.c\
../recSub.c\
../recSubArray.c\
../recTimer.c\
../recWaveform.c\
../recWait.c\
../caMonitor.c
# ../recPal.c\
# ../recSwitch.c\
# ../recGsub.c\
# ../recAai.c\
# ../recAao.c
# SRCS.c += ../recAai.c
# SRCS.c += ../recAao.c
SRCS.c += ../recAi.c
SRCS.c += ../recAo.c
SRCS.c += ../recBi.c
SRCS.c += ../recBo.c
SRCS.c += ../recCalc.c
SRCS.c += ../recCompress.c
SRCS.c += ../recDfanout.c
SRCS.c += ../recEg.c
SRCS.c += ../recEgevent.c
SRCS.c += ../recEr.c
SRCS.c += ../recErevent.c
SRCS.c += ../recEvent.c
SRCS.c += ../recFanout.c
# SRCS.c += ../recGsub.c
SRCS.c += ../recHistogram.c
SRCS.c += ../recLongin.c
SRCS.c += ../recLongout.c
SRCS.c += ../recMbbi.c
SRCS.c += ../recMbbiDirect.c
SRCS.c += ../recMbbo.c
SRCS.c += ../recMbboDirect.c
# SRCS.c += ../recPal.c
SRCS.c += ../recPermissive.c
SRCS.c += ../recPid.c
SRCS.c += ../recPulseCounter.c
SRCS.c += ../recPulseDelay.c
SRCS.c += ../recPulseTrain.c
SRCS.c += ../recScan.c
SRCS.c += ../recSel.c
SRCS.c += ../recSeq.c
SRCS.c += ../recState.c
SRCS.c += ../recSteppermotor.c
SRCS.c += ../recStringin.c
SRCS.c += ../recStringout.c
SRCS.c += ../recSub.c
SRCS.c += ../recSubArray.c
# SRCS.c += ../recSwitch.c
SRCS.c += ../recTimer.c
SRCS.c += ../recWait.c
SRCS.c += ../recWaitCa.c
SRCS.c += ../recWaveform.c
OBJS = \
recAi.o\
recPulseDelay.o\
recAo.o\
recHistogram.o\
recPulseTrain.o\
recBi.o\
recLongin.o\
recSel.o\
recBo.o\
recLongout.o\
recSeq.o\
recCalc.o\
recMbbi.o\
recState.o\
recCompress.o\
recMbbiDirect.o\
recSteppermotor.o\
recEg.o\
recMbbo.o\
recStringin.o\
recEgevent.o\
recMbboDirect.o\
recStringout.o\
recEr.o\
recSub.o\
recErevent.o\
recPermissive.o\
recEvent.o\
recPid.o\
recTimer.o\
recFanout.o\
recPulseCounter.o\
recWaveform.o\
recSubArray.o\
recWait.o\
recScan.o\
recDfanout.o\
recMbbiDirect.o\
recMbboDirect.o\
caMonitor.o
# recPal.o\
# recSwitch.o\
# recGsub.o\
# recAai.o\
# recAao.o\
# OBJS += recAai.o
# OBJS += recAao.o
OBJS += recAi.o
OBJS += recAo.o
OBJS += recBi.o
OBJS += recBo.o
OBJS += recCalc.o
OBJS += recCompress.o
OBJS += recDfanout.o
OBJS += recEg.o
OBJS += recEgevent.o
OBJS += recEr.o
OBJS += recErevent.o
OBJS += recEvent.o
OBJS += recFanout.o
# OBJS += recGsub.o
OBJS += recHistogram.o
OBJS += recLongin.o
OBJS += recLongout.o
OBJS += recMbbi.o
OBJS += recMbbiDirect.o
OBJS += recMbbo.o
OBJS += recMbboDirect.o
# OBJS += recPal.o
OBJS += recPermissive.o
OBJS += recPid.o
OBJS += recPulseCounter.o
OBJS += recPulseDelay.o
OBJS += recPulseTrain.o
OBJS += recScan.o
OBJS += recSel.o
OBJS += recSeq.o
OBJS += recState.o
OBJS += recSteppermotor.o
OBJS += recStringin.o
OBJS += recStringout.o
OBJS += recSub.o
OBJS += recSubArray.o
# OBJS += recSwitch.o
OBJS += recTimer.o
OBJS += recWait.o
OBJS += recWaitCa.o
OBJS += recWaveform.o
PROD = recSup
@@ -105,5 +100,3 @@ $(PROD): $(OBJS)
$(RM) $@
$(LINK.c) $@ $(OBJS) $(LDLIBS)

View File

@@ -48,9 +48,21 @@
* .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
* .11 02-21-95 nda added "Return To Start" flag. If set, positioners
* will be commanded to the start pos after the scan.
* .12 03-02-95 nda added positioner readback arrays (PxRA). These arrays
* will contain actual readback positions (if RxPV are
* defined. If not, the desired positions will be loaded
* into them.
* .13 03-02-95 nda Post .val field when a new point is complete during a
* scan. This will assist in poin by point plots.
* .14 03-02-95 nda Bug fix on filling PxRA's. ALWAYS CALL CHCK_MOTORS.
* .15 03-15-95 nda If no readback PV (RxPV) is specified, copy desired
* value (PxDV) to current value (RxCV). Now, plotting
* programs can always monitor RxCV.
*/
#define VERSION 1.10
#define VERSION 1.15
@@ -274,6 +286,11 @@ static long init_record(pscan,pass)
pscan->p3pa = (float *) calloc(pscan->mpts, sizeof(float));
pscan->p4pa = (float *) calloc(pscan->mpts, sizeof(float));
pscan->p1ra = (float *) calloc(pscan->mpts, sizeof(float));
pscan->p2ra = (float *) calloc(pscan->mpts, sizeof(float));
pscan->p3ra = (float *) calloc(pscan->mpts, sizeof(float));
pscan->p4ra = (float *) calloc(pscan->mpts, sizeof(float));
/* First time through, rpvt needs initialized */
pscan->rpvt = calloc(1, sizeof(struct recPvtStruct));
precPvt = (struct recPvtStruct *)pscan->rpvt;
@@ -338,7 +355,10 @@ static long process(pscan)
if(scanRecDebug) {
precPvt->tickStart = tickGet();
}
pscan->cpt = 0; /* reset point counter */
initScan(pscan);
sprintf(pscan->smsg,"Scanning ...");
db_post_events(pscan,&pscan->smsg,DBE_VALUE);
}
else if ((pscan->pxsc == 1) && (pscan->exsc == 0)) {
@@ -497,6 +517,14 @@ static long cvt_dbaddr(paddr)
paddr->pfield = (void *)(pscan->p3pa);
} else if (paddr->pfield == &(pscan->p4pa)) {
paddr->pfield = (void *)(pscan->p4pa);
} else if (paddr->pfield == &(pscan->p1ra)) {
paddr->pfield = (void *)(pscan->p1ra);
} else if (paddr->pfield == &(pscan->p2ra)) {
paddr->pfield = (void *)(pscan->p2ra);
} else if (paddr->pfield == &(pscan->p3ra)) {
paddr->pfield = (void *)(pscan->p3ra);
} else if (paddr->pfield == &(pscan->p4ra)) {
paddr->pfield = (void *)(pscan->p4ra);
} else if (paddr->pfield == &(pscan->d1da)) {
paddr->pfield = (void *)(pscan->d1da);
} else if (paddr->pfield == &(pscan->d2da)) {
@@ -555,6 +583,18 @@ static long get_array_info(paddr,no_elements,offset)
} else if (paddr->pfield == pscan->p4pa) {
*no_elements = pscan->mpts;
*offset = 0;
} else if (paddr->pfield == pscan->p1ra) {
*no_elements = pscan->mpts;
*offset = 0;
} else if (paddr->pfield == pscan->p2ra) {
*no_elements = pscan->mpts;
*offset = 0;
} else if (paddr->pfield == pscan->p3ra) {
*no_elements = pscan->mpts;
*offset = 0;
} else if (paddr->pfield == pscan->p4ra) {
*no_elements = pscan->mpts;
*offset = 0;
} else {
*no_elements = 0;
*offset = 0;
@@ -850,6 +890,11 @@ static void checkMonitors(pscan)
db_post_events(pscan,&pscan->r4cv, DBE_VALUE);
pscan->r4lv = pscan->r4cv;
}
/* Post a monitor on VAL to indicate new point */
if(pscan->exsc) {
db_post_events(pscan,&pscan->val, DBE_VALUE);
}
}
if (pscan->pxsc != pscan->exsc)
@@ -861,6 +906,10 @@ static void checkMonitors(pscan)
db_post_events(pscan,pscan->p2pa, DBE_VALUE);
db_post_events(pscan,pscan->p3pa, DBE_VALUE);
db_post_events(pscan,pscan->p4pa, DBE_VALUE);
db_post_events(pscan,pscan->p1ra, DBE_VALUE);
db_post_events(pscan,pscan->p2ra, DBE_VALUE);
db_post_events(pscan,pscan->p3ra, DBE_VALUE);
db_post_events(pscan,pscan->p4ra, DBE_VALUE);
/* For the following arrays that are "double buffered", it is
currently necessary to post_events on both buffers because
@@ -941,8 +990,6 @@ struct scanRecord *pscan;
long nRequest = 1;
long options = 0;
pscan->cpt = 0;
/* Figure out starting positions for each positioner */
if(pscan->p1sm == REC_SCAN_MO_TAB) {
pscan->p1dv = pscan->p1pa[0];
@@ -976,8 +1023,6 @@ struct scanRecord *pscan;
precPvt->phase = MOVE_MOTORS;
/* request callback to do dbPutFields */
callbackRequest(&precPvt->doPutsCallback);
sprintf(pscan->smsg,"Scanning ...");
db_post_events(pscan,&pscan->smsg,DBE_VALUE);
return;
}
@@ -1001,9 +1046,11 @@ struct scanRecord *pscan;
case CHCK_MOTORS:
/* motors have stopped. Check readbacks and deadbands */
/* Also fill in PxRA (readback array) from RxCV or PxDV */
if(!pscan->r1nv) {
status = dbGet(pscan->r1db, DBR_FLOAT, &(pscan->r1cv),
&options, &nRequest, NULL);
pscan->p1ra[pscan->cpt] = pscan->r1cv;
if((pscan->r1dl > 0) &&
(fabs(pscan->p1dv - pscan->r1cv) > pscan->r1dl)) {
sprintf(pscan->smsg,"SCAN Aborted: P1 Readback > delta");
@@ -1011,11 +1058,15 @@ struct scanRecord *pscan;
precPvt->scanErr = 1;
abortScan = 1;
}
} else {
pscan->r1cv = pscan->p1dv;
pscan->p1ra[pscan->cpt] = pscan->p1dv;
}
if(!pscan->r2nv) {
nRequest = 1;
status = dbGet(pscan->r2db, DBR_FLOAT, &(pscan->r2cv),
&options, &nRequest, NULL);
pscan->p2ra[pscan->cpt] = pscan->r2cv;
if((pscan->r2dl > 0) &&
(fabs(pscan->p2dv - pscan->r2cv) > pscan->r2dl)) {
sprintf(pscan->smsg,"SCAN Aborted: P2 Readback > delta");
@@ -1023,11 +1074,15 @@ struct scanRecord *pscan;
precPvt->scanErr = 1;
abortScan = 1;
}
} else { /* no readback PV, stuff with desired value */
pscan->r2cv = pscan->p2dv;
pscan->p2ra[pscan->cpt] = pscan->p2dv;
}
if(!pscan->r3nv) {
nRequest = 1;
status = dbGet(pscan->r3db, DBR_FLOAT, &(pscan->r3cv),
&options, &nRequest, NULL);
pscan->p3ra[pscan->cpt] = pscan->r3cv;
if((pscan->r3dl > 0) &&
(fabs(pscan->p3dv - pscan->r3cv) > pscan->r3dl)) {
sprintf(pscan->smsg,"SCAN Aborted: P3 Readback > delta");
@@ -1035,11 +1090,15 @@ struct scanRecord *pscan;
precPvt->scanErr = 1;
abortScan = 1;
}
} else { /* no readback PV, stuff with desired value */
pscan->r3cv = pscan->p3dv;
pscan->p3ra[pscan->cpt] = pscan->p3dv;
}
if(!pscan->r4nv) {
nRequest = 1;
status = dbGet(pscan->r4db, DBR_FLOAT, &(pscan->r4cv),
&options, &nRequest, NULL);
pscan->p4ra[pscan->cpt] = pscan->r4cv;
if((pscan->r4dl > 0) &&
(fabs(pscan->p4dv - pscan->r4cv) > pscan->r4dl)) {
sprintf(pscan->smsg,"SCAN Aborted: P4 Readback > delta");
@@ -1047,6 +1106,9 @@ struct scanRecord *pscan;
precPvt->scanErr = 1;
abortScan = 1;
}
} else { /* no readback PV, stuff with desired value */
pscan->r4cv = pscan->p4dv;
pscan->p4ra[pscan->cpt] = pscan->p4dv;
}
if(abortScan) {
@@ -1202,6 +1264,26 @@ struct scanRecord *pscan;
pscan->p4pa[counter] = pscan->p4dv;
}
if(!pscan->r1nv)
pscan->p1ra[counter] = pscan->r1cv;
else
pscan->p1ra[counter] = pscan->p1dv;
if(!pscan->r2nv)
pscan->p2ra[counter] = pscan->r2cv;
else
pscan->p2ra[counter] = pscan->p2dv;
if(!pscan->r3nv)
pscan->p3ra[counter] = pscan->r3cv;
else
pscan->p3ra[counter] = pscan->p3dv;
if(!pscan->r4nv)
pscan->p4ra[counter] = pscan->r4cv;
else
pscan->p4ra[counter] = pscan->p4dv;
counter++;
}
@@ -1233,6 +1315,14 @@ struct scanRecord *pscan;
}
pscan->exsc = 0; /* done with scan */
/* if the "Return To Start: flag is set, command positioners
to their start positions via initScan */
if(pscan->rtst) {
initScan(pscan);
}
return;
}
@@ -1259,18 +1349,10 @@ static long nRequest = 1;
switch (precPvt->phase) {
case MOVE_MOTORS:
/* next processing of records means motors have stopped */
/* Schedule the next phase depending on readback PV validity */
/* Schedule the next phase as CHCK_MOTORS */
/* This needs to come before moving motors */
if(precPvt->validRbPvs) {
precPvt->phase = CHCK_MOTORS;
}
else if(precPvt->validDtPvs) {
precPvt->phase = TRIG_DETCTRS;
}
else {
precPvt->phase = READ_DETCTRS;
}
precPvt->phase = CHCK_MOTORS;
/* for each valid positioner, write the desired position */
if(!precPvt->pscan->p1nv) {

View File

@@ -27,23 +27,28 @@
*
* Modification Log:
* -----------------
* .01 05-31-94 nda initial try
* .02 07-11-94 mrk/nda added "process on input change" feature
* .03 08-16-94 mrk/nda continuing "process on input change" feature
* .04 08-16-94 nda record does not get notified when a SCAN related field changes,
* 1.01 05-31-94 nda initial try
* 1.02 07-11-94 mrk/nda added "process on input change" feature
* 1.03 08-16-94 mrk/nda continuing "process on input change" feature
* 1.04 08-16-94 nda record does not get notified when a SCAN related field changes,
* so for now we have to always add monitors. Search for MON_ALWAYS
* Modifications for this are flagged with MON_ALWAYS
* .05 08-18-94 nda Starting with R3.11.6, dbGetField locks the record before fetching
* 1.05 08-18-94 nda Starting with R3.11.6, dbGetField locks the record before fetching
* the data. This can cause deadlocks within a database. Change all
* 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)
* 1.06 08-19-94 nda added Output data option of VAL or DOL
* 1.07 09-14-94 nda corrected bug that caused SCAN_DISABLE to lock up the record forever
* 1.08 02-01-95 nda added VERS and ODLY (output execution delay)
* 1.09 02-15-95 nda addedd INxP to determine which inputs should cause the record
* to process when in I/O INTR mode.
* 2.00 02-20-95 nda added queuing to SCAN_IO_EVENT mode so no transitions of data
* would be missed. Can put back to cached mode by setting
* recWaitCacheMode (effects all wait records !)
*
*
*/
#define VERSION 1.08
#define VERSION 2.00
@@ -67,6 +72,7 @@
#include <dbFldTypes.h>
#include <devSup.h>
#include <errMdef.h>
#include <rngLib.h>
#include <recSup.h>
#include <special.h>
#include <callback.h>
@@ -74,7 +80,7 @@
#include <choiceWait.h>
#include <waitRecord.h>
#include <caMonitor.h>
#include <recWaitCa.h>
/* Create RSET - Record Support Entry Table*/
@@ -117,7 +123,6 @@ struct rset waitRSET={
get_alarm_double
};
/* Create DSET for "soft channel" to allow for IO Event (this is to implement
the feature of processing the record when an input changes) */
@@ -140,32 +145,28 @@ struct {
/* DEFINES */
#define ARG_MAX 12
#define PVN_SIZE 40 /* must match the string length defined in waitRecord.ascii */
#define PVN_SIZE 40 /* must match the string length defined in waitRecord.ascii */
#define Q_SIZE 50
/***************************
Declare constants
***************************/
int waitRecDebug=0;
static unsigned long tickStart;
static void schedOutput();
static void reqOutput();
static void execOutput();
static int fetch_values();
static void monitor();
static long initSiml();
static void inputChanged();
/**********************************************
Declare constants and structures
***********************************************/
/* callback structure and miscellaneous data */
/* callback structures and record private data */
struct cbStruct {
CALLBACK callback; /* code assumes CALLBACK is 1st in structure */
CALLBACK doOutCb; /* callback structure for executing the output link */
CALLBACK ioProcCb; /* callback structure for io_event scanning */
struct waitRecord *pwait; /* pointer to wait record which needs work done */
WDOG_ID wd_id; /* Watchdog used for delays */
RECWAITCA inpMonitor[ARG_MAX]; /* required structures for each input variable */
RING_ID monitorQ; /* queue to store ca callback data */
unsigned short inpMonFlag[ARG_MAX];
IOSCANPVT ioscanpvt; /* used for IO_EVENT scanning */
CAMONITOR inpMonitor[12]; /* required structures for each input variable */
int outputWait; /* flag to indicate waiting to do output */
int procPending; /* flag to indicate record processing is pending */
unsigned long tickStart; /* used for timing */
};
static long get_ioint_info(cmd,pwait,ppvt)
int cmd;
@@ -177,6 +178,26 @@ static long get_ioint_info(cmd,pwait,ppvt)
}
/* This is the data that will be put on the work queue ring buffer */
struct qStruct {
char inputIndex;
double monData;
};
int recWaitDebug=0;
int recWaitCacheMode=0;
static unsigned long tickStart;
static void schedOutput(struct waitRecord *pwait);
static void reqOutput(struct waitRecord *pwait);
static void execOutput(struct cbStruct *pcbst);
static int fetch_values(struct waitRecord *pwait);
static void monitor(struct waitRecord *pwait);
static long initSiml();
static void inputChanged(struct recWaitCa *pcamonitor, char inputIndex, double monData);
static void ioIntProcess(CALLBACK *pioProcCb);
static long init_record(pwait,pass)
struct waitRecord *pwait;
int pass;
@@ -185,9 +206,10 @@ static long init_record(pwait,pass)
long status = 0;
int i;
char *ppvn[PVN_SIZE];
struct dbAddr **ppdbAddr; /* ptr to a ptr to dbAddr */
long *paddrValid;
char *ppvn[PVN_SIZE];
struct dbAddr **ppdbAddr; /* ptr to a ptr to dbAddr */
long *paddrValid;
unsigned short *piointInc; /* include for IO_INT ? */
char rpbuf[184];
short error_number;
@@ -214,10 +236,11 @@ static long init_record(pwait,pass)
*ppvn = &pwait->inan[0];
for(i=0;i<ARG_MAX; i++, *ppvn += PVN_SIZE) {
((struct cbStruct *)pwait->cbst)->inpMonitor[i].channame = (char *)*ppvn;
((struct cbStruct *)pwait->cbst)->inpMonitor[i].inputIndex = i;
((struct cbStruct *)pwait->cbst)->inpMonitor[i].callback = inputChanged;
((struct cbStruct *)pwait->cbst)->inpMonitor[i].userPvt = pwait;
}
/* do scanIoInit here because init_dev doesn't know which record */
scanIoInit(&(((struct cbStruct *)pwait->cbst)->ioscanpvt));
@@ -226,6 +249,10 @@ static long init_record(pwait,pass)
/* Do initial lookup of PV Names to dbAddr's */
/* This is pass == 1, so pwait->cbst is valid */
pcbst = (struct cbStruct *)pwait->cbst;
*ppvn = &pwait->inan[0];
ppdbAddr = (struct dbAddr **)&pwait->inaa;
paddrValid = &pwait->inav;
@@ -247,31 +274,42 @@ static long init_record(pwait,pass)
}
db_post_events(pwait,&pwait->clcv,DBE_VALUE);
callbackSetCallback(execOutput, &((struct cbStruct *)pwait->cbst)->callback);
callbackSetPriority(pwait->prio, &((struct cbStruct *)pwait->cbst)->callback);
pcbst = (struct cbStruct *)pwait->cbst;
callbackSetCallback(execOutput, &pcbst->doOutCb);
callbackSetPriority(pwait->prio, &pcbst->doOutCb);
callbackSetCallback(ioIntProcess, &pcbst->ioProcCb);
callbackSetPriority(pwait->prio, &pcbst->ioProcCb);
callbackSetUser(pwait, &pcbst->ioProcCb);
pcbst->pwait = pwait;
pcbst->wd_id = wdCreate();
if((pcbst->monitorQ = rngCreate(sizeof(struct qStruct) * Q_SIZE)) == NULL) {
errMessage(0,"recWait can't create ring buffer");
exit(1);
}
/* Set up monitors on input channels if scan type is IO Event */
/* MON_ALWAYS if(pwait->scan == SCAN_IO_EVENT) { */
if(1) {
paddrValid = &pwait->inav;
piointInc = &pwait->inap;
for(i=0;i<ARG_MAX; i++, paddrValid++) {
if(!(*paddrValid)) {
if(waitRecDebug) printf("adding monitor\n");
status = caMonitorAdd(&(((struct cbStruct *)pwait->cbst)->inpMonitor[i]));
if(status) errMessage(status,"caMonitorAdd error");
for(i=0;i<ARG_MAX; i++, paddrValid++, piointInc++) {
/* store current value in private array */
pcbst->inpMonFlag[i] = *piointInc;
/* if valid PV AND input include flag is true ... */
if(!(*paddrValid) && (*piointInc)) {
if(recWaitDebug) printf("adding monitor on input %d\n", i);
status = recWaitCaAdd(&(((struct cbStruct *)pwait->cbst)->inpMonitor[i]));
if(status) errMessage(status,"recWaitCaAdd error");
}
}
}
if (status=initSiml(pwait)) return(status);
/* now reset procPending so the next monitor processes the record */
((struct cbStruct *)pwait->cbst)->procPending = 0;
/* reset miscellaneous flags */
pcbst->outputWait = 0;
pcbst->procPending = 0;
pwait->init = TRUE;
return(0);
@@ -286,13 +324,12 @@ static long process(pwait)
long options = 0;
pwait->pact = TRUE;
pwait->oval = pwait->val;
/* Check for simulation mode */
status=recGblGetLinkValue(&(pwait->siml),
(void *)pwait,DBR_ENUM,&(pwait->simm),&options,&nRequest);
/* reset procPending before getting values so we don't miss any monitors */
/* reset procPending before getting values */
((struct cbStruct *)pwait->cbst)->procPending = 0;
if(pwait->simm == NO) {
@@ -353,6 +390,8 @@ static long process(pwait)
break;
}
pwait->oval = pwait->val;
recGblGetTimeStamp(pwait);
/* check event list */
monitor(pwait);
@@ -368,47 +407,48 @@ static long special(paddr,after)
int after;
{
struct waitRecord *pwait = (struct waitRecord *)(paddr->precord);
struct cbStruct *pcbst = (struct cbStruct *)pwait->cbst;
int special_type = paddr->special;
char *ppvn[PVN_SIZE];
struct dbAddr **ppdbAddr; /* ptr to a ptr to dbAddr */
long *paddrValid;
unsigned short *piointInc; /* include for IO_INT ? */
int i;
long status;
long odbv =0;
short error_number;
char rpbuf[184];
if(waitRecDebug) printf("entering special \n");
if(!after) { /* this is called before ca changes the field */
switch(special_type) {
case(SPC_SCAN): /* about to change SCAN mechanism ... */
if(pwait->scan == SCAN_IO_EVENT) {
/* Leaving IO_EVENT, delete monitors */
paddrValid = &pwait->inav;
for(i=0;i<ARG_MAX; i++, paddrValid++) {
if(!(*paddrValid)) {
if(waitRecDebug) printf("deleting monitor\n");
status = caMonitorDelete(&(((struct cbStruct *)pwait->cbst)->inpMonitor[i]));
if(status) errMessage(status,"caMonitorDelete error");
}
}
}
break;
if(recWaitDebug) printf("entering special %d \n",after);
case(SPC_MOD): /* check if changing any PV names while monitored */
/* MON_ALWAYS if(pwait->scan == SCAN_IO_EVENT) { */
if(1) {
*ppvn = &pwait->inan[0];
paddrValid = &pwait->inav;
for(i=0;i<ARG_MAX; i++, *ppvn += PVN_SIZE, paddrValid++) {
if((paddr->pfield==*ppvn) && !(*paddrValid)) {
if(waitRecDebug) printf("deleting monitor\n");
status = caMonitorDelete(&(((struct cbStruct *)pwait->cbst)->inpMonitor[i]));
if(status) errMessage(status,"caMonitorDelete error");
}
}
}
break;
if(!after) { /* this is called before ca changes the field */
/* MON_ALWAYS This case doesn't currently happen */
if((special_type == SPC_SCAN) && (pwait->scan == SCAN_IO_EVENT)) {
/* Leaving IO_EVENT, delete monitors */
paddrValid = &pwait->inav;
for(i=0;i<ARG_MAX; i++, paddrValid++) {
if(!(*paddrValid)) {
if(recWaitDebug) printf("deleting monitor\n");
status = recWaitCaDelete(&pcbst->inpMonitor[i]);
if(status) errMessage(status,"recWaitCaDelete error");
}
}
return(0);
}
/* check if changing any Input PV names while monitored */
if((paddr->pfield >= (void *)pwait->inan) &&
(paddr->pfield <= (void *)pwait->inln)) {
/* About to change a PV, delete that particular monitor */
i = special_type - REC_WAIT_A; /* index of input */
paddrValid = &pwait->inav + i; /* pointer arithmetic */
piointInc = &pwait->inap + i; /* pointer arithmetic */
/* If PV name is valid and the INxP flag is true, ... */
if(!(*paddrValid) && (*piointInc)) {
if(recWaitDebug) printf("deleting monitor on input %d\n",i);
status = recWaitCaDelete(&pcbst->inpMonitor[i]);
if(status) errMessage(status,"recWaitCaDelete error");
}
}
return(0);
}
@@ -416,38 +456,72 @@ static long special(paddr,after)
/* this is executed after ca changed the field */
switch(special_type) {
case(SPC_SCAN): /* Changed SCAN mechanism, set monitors on input links */
/* MON_ALWAYS This case currently doesn't happen */
if(pwait->scan == SCAN_IO_EVENT) {
paddrValid = &pwait->inav;
for(i=0;i<ARG_MAX; i++, paddrValid++) {
if(!(*paddrValid)) {
if(waitRecDebug) printf("adding monitor\n");
status = caMonitorAdd(&(((struct cbStruct *)pwait->cbst)->inpMonitor[i]));
if(status) errMessage(status,"caMonitorAdd error");
if(recWaitDebug) printf("adding monitor on input %d\n", i);
status = recWaitCaAdd(&pcbst->inpMonitor[i]);
if(status) errMessage(status,"recWaitCaAdd error");
}
}
}
return(0);
case(SPC_MOD): /* check if changing any PV names */
*ppvn = &pwait->inan[0];
ppdbAddr = (struct dbAddr **)&pwait->inaa;
paddrValid = &pwait->inav;
break;
case(REC_WAIT_A): /* check if changing any input PV's or flags */
case(REC_WAIT_B):
case(REC_WAIT_C):
case(REC_WAIT_D):
case(REC_WAIT_E):
case(REC_WAIT_F):
case(REC_WAIT_G):
case(REC_WAIT_H):
case(REC_WAIT_I):
case(REC_WAIT_J):
case(REC_WAIT_K):
case(REC_WAIT_L):
i = special_type - REC_WAIT_A; /* index of input */
paddrValid = &pwait->inav + i; /* pointer arithmetic */
ppdbAddr = (struct dbAddr **)&pwait->inaa + i; /* pointer arithmetic */
*ppvn = &pwait->inan[0] + (i*PVN_SIZE);
piointInc = &pwait->inap + i; /* pointer arithmetic */
for(i=0;i<ARG_MAX; i++, *ppvn += PVN_SIZE, ppdbAddr++, paddrValid++) {
if(paddr->pfield==*ppvn) {
odbv = *paddrValid;
*paddrValid = dbNameToAddr(*ppvn, *ppdbAddr);
if (odbv != *paddrValid) {
db_post_events(pwait,paddrValid,DBE_VALUE);
}
/* MON_ALWAYS if((pwait->scan == SCAN_IO_EVENT) && !(*paddrValid)) { */
if((1) && !(*paddrValid)) {
if(waitRecDebug) printf("adding monitor\n");
status = caMonitorAdd(&(((struct cbStruct *)pwait->cbst)->inpMonitor[i]));
if(status) errMessage(status,"caMonitorAdd error");
}
return(0);
}
}
/* If the PV Name changing, do dbNameToAddr */
if(paddr->pfield==*ppvn) {
odbv = *paddrValid;
*paddrValid = dbNameToAddr(*ppvn, *ppdbAddr);
if (odbv != *paddrValid) {
db_post_events(pwait,paddrValid,DBE_VALUE);
}
/* MON_ALWAYS: Should only do if SCAN_IO_EVENT), but can't now */
/* If the INxP flag is set, add a monitor */
if(!(*paddrValid) && (*piointInc)) {
if(recWaitDebug) printf("adding monitor on input %d\n", i);
status = recWaitCaAdd(&pcbst->inpMonitor[i]);
if(status) errMessage(status,"recWaitCaAdd error");
}
}
/* Must be the I/O INTR flag that changed. Compare to previous value */
else {
if(!(*paddrValid) && (*piointInc) && !(pcbst->inpMonFlag[i])) {
if(recWaitDebug) printf("adding monitor on input %d\n", i);
status = recWaitCaAdd(&pcbst->inpMonitor[i]);
if(status) errMessage(status,"recWaitCaAdd error");
}
else if(!(*paddrValid) && !(*piointInc) && (pcbst->inpMonFlag[i])) {
if(recWaitDebug) printf("deleting monitor on input %d\n", i);
status = recWaitCaDelete(&pcbst->inpMonitor[i]);
if(status) errMessage(status,"recWaitCaDelete error");
}
pcbst->inpMonFlag[i] = *piointInc; /* keep track of current val */
}
return(0);
break;
case(SPC_MOD): /* check if changing any other SPC_MOD fields */
if(paddr->pfield==pwait->outn) { /* this is the output link */
odbv = pwait->outv;
pwait->outv = dbNameToAddr(pwait->outn,(struct dbAddr *)pwait->outa);
@@ -463,10 +537,12 @@ static long special(paddr,after)
}
}
else if(paddr->pfield==(void *)&pwait->prio) {
callbackSetPriority(pwait->prio, &((struct cbStruct *)pwait->cbst)->callback);
callbackSetPriority(pwait->prio, &((struct cbStruct *)pwait->cbst)->doOutCb);
callbackSetPriority(pwait->prio, &((struct cbStruct *)pwait->cbst)->ioProcCb);
}
return(0);
break;
case(SPC_CALC):
pwait->clcv=postfix(pwait->calc,rpbuf,&error_number);
@@ -481,6 +557,7 @@ static long special(paddr,after)
db_post_events(pwait,pwait->calc,DBE_VALUE);
db_post_events(pwait,pwait->clcv,DBE_VALUE);
return(0);
break;
default:
recGblDbaddrError(S_db_badChoice,paddr,"wait: special");
return(S_db_badChoice);
@@ -626,14 +703,17 @@ struct waitRecord *pwait;
struct dbAddr **ppdba; /* a ptr to a ptr to dbAddr */
double *pvalue;
long *pvalid;
unsigned short *piointInc; /* include for IO_INT ? */
long status=0,options=0,nRequest=1;
int i;
piointInc = &pwait->inap;
for(i=0, ppdba= (struct dbAddr **)&pwait->inaa, pvalue=&pwait->a, pvalid = &pwait->inav;
i<ARG_MAX; i++, ppdba++, pvalue++, pvalid++) {
i<ARG_MAX; i++, ppdba++, pvalue++, pvalid++, piointInc++) {
/* only fetch a value if the dbAddr is valid, otherwise, leave it alone */
if(!(*pvalid)) {
/* if in SCAN_IO_EVENT, only fetch inputs if INxP != 1 (not monitored) */
if(!(*pvalid) && !((pwait->scan == SCAN_IO_EVENT) && (*piointInc))) {
status = dbGet(*ppdba, DBR_DOUBLE,
pvalue, &options, &nRequest, NULL);
}
@@ -648,6 +728,7 @@ struct waitRecord *pwait;
* 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.
* NOTE: THE RECORD REMAINS "ACTIVE" WHILE WAITING ON THE WATCHDOG
*
******************************************************************************/
static void schedOutput(pwait)
@@ -660,6 +741,7 @@ int wdDelay;
if(pwait->odly > 0.0) {
/* Use the watch-dog as a delay mechanism */
pcbst->outputWait = 1;
wdDelay = pwait->odly * sysClkRateGet();
wdStart(pcbst->wd_id, wdDelay, (FUNCPTR)reqOutput, (int)(pwait));
} else {
@@ -714,6 +796,7 @@ static double oldDold;
recGblFwdLink(pcbst->pwait);
pcbst->pwait->pact = FALSE;
pcbst->outputWait = 0;
/* If I/O Interrupt scanned, see if any inputs changed during delay */
if((pcbst->pwait->scan == SCAN_IO_EVENT) && (pcbst->procPending == 1)) {
@@ -725,7 +808,11 @@ static double oldDold;
static void inputChanged(struct caMonitor *pcamonitor)
/* This routine is called by the recWaitCaTask whenver a monitored input
changes. The input index and new data is put on a work queue, and a callback
request is issued to the routine ioIntProcess
*/
static void inputChanged(struct recWaitCa *pcamonitor, char inputIndex, double monData)
{
struct waitRecord *pwait = (struct waitRecord *)pcamonitor->userPvt;
@@ -734,17 +821,80 @@ static void inputChanged(struct caMonitor *pcamonitor)
/* the next line is here because the monitors are always active ... MON_ALWAYS */
if(pwait->scan != SCAN_IO_EVENT) return;
/* if record hasn't been processed or is DISABLED, don't set procPending yet */
if((pwait->stat == DISABLE_ALARM) || pwait->udf) {
if(waitRecDebug) printf("processing due to monitor\n");
scanIoRequest(pcbst->ioscanpvt);
} else if(pcbst->procPending) {
if(waitRecDebug) printf("discarding monitor\n");
return;
} else {
pcbst->procPending = 1;
if(waitRecDebug) printf("processing due to monitor\n");
scanIoRequest(pcbst->ioscanpvt);
}
if(recWaitCacheMode) {
/* if record hasn't been processed or is DISABLED, don't set procPending yet */
if((pwait->stat == DISABLE_ALARM) || pwait->udf) {
if(recWaitDebug>=5) printf("queuing monitor (cached)\n");
callbackRequest(&pcbst->ioProcCb);
} else if(pcbst->procPending) {
/* if(recWaitDebug) printf("discarding monitor\n"); */
printf("discarding monitor\n");
return;
} else {
pcbst->procPending = 1;
if(recWaitDebug>=5) printf("queuing monitor (cached)\n");
callbackRequest(&pcbst->ioProcCb);
}
}
else { /* put input index and monitored data on processing queue */
if(recWaitDebug>=5) printf("queuing monitor on %d = %lf\n", inputIndex, monData);
if(rngBufPut(pcbst->monitorQ, (void *)&inputIndex, sizeof(char))
!= sizeof(char)) errMessage(0,"recWait rngBufPut error");
if(rngBufPut(pcbst->monitorQ, (void *)&monData, sizeof(double))
!= sizeof(double)) errMessage(0,"recWait rngBufPut error");
callbackRequest(&pcbst->ioProcCb);
}
}
/* This routine performs the record processing when in SCAN_IO_EVENT. An
event queue is built by inputChanged() and emptied here so each change
of an input causes the record to process.
*/
static void ioIntProcess(CALLBACK *pioProcCb)
{
struct waitRecord *pwait;
struct cbStruct *pcbst;
char inputIndex;
double monData;
double *pInput;
callbackGetUser(pwait, pioProcCb);
pcbst = (struct cbStruct *)pwait->cbst;
pInput = &pwait->a; /* a pointer to the first input field */
if(pwait->scan != SCAN_IO_EVENT) return;
if(!recWaitCacheMode) {
if(rngBufGet(pcbst->monitorQ, (void *)&inputIndex, sizeof(char))
!= sizeof(char)) errMessage(0, "recWait: rngBufGet error");
if(rngBufGet(pcbst->monitorQ, (void *)&monData, sizeof(double))
!= sizeof(double)) errMessage(0, "recWait: rngBufGet error");
if(recWaitDebug>=5) printf("processing on %d = %lf (%lf)\n", inputIndex, monData,pwait->val);
pInput += inputIndex; /* pointer arithmetic to choose appropriate input */
dbScanLock((struct dbCommon *)pwait);
*pInput = monData; /* put data in input data field */
/* Process the record, unless it's busy waiting to do the output link */
if(pcbst->outputWait) {
pcbst->procPending = 1;
if(recWaitDebug) printf("record busy, setting procPending\n");
}
else {
dbProcess((struct dbCommon *)pwait); /* process the record */
}
dbScanUnlock((struct dbCommon *)pwait);
}
else {
if(recWaitDebug>=5) printf("processing (cached)\n");
dbScanLock((struct dbCommon *)pwait);
dbProcess((struct dbCommon *)pwait); /* process the record */
dbScanUnlock((struct dbCommon *)pwait);
}
}

173
src/rec/recWaitCa.c Normal file
View File

@@ -0,0 +1,173 @@
#include <vxWorks.h>
#include <taskLib.h>
#include <string.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include <rngLib.h>
#include <vxLib.h>
#include <dbDefs.h>
#include <taskwd.h>
#include <fast_lock.h>
#include <cadef.h>
#include <caerr.h>
#include <caeventmask.h>
#include <calink.h>
#include <task_params.h>
#include <recWaitCa.h>
extern int interruptAccept;
#define QUEUE_SIZE 256
LOCAL int taskid=0;
LOCAL RING_ID ringQ;;
LOCAL FAST_LOCK lock;
typedef enum {cmdNone,cmdAdd,cmdRemove} COMMAND;
typedef struct {
RECWAITCA *pcamonitor;
chid chid;
evid evid;
COMMAND cmd;
int hasMonitor;
struct dbr_sts_double rtndata; /*Not currently used */
} CAPVT;
void recWaitCaTask(void);
LOCAL void eventCallback(struct event_handler_args eha)
{
struct dbr_sts_double *pdata = eha.dbr;
CAPVT *pcapvt;
RECWAITCA *pcamonitor;
pcapvt = (CAPVT *)eha.usr;
pcamonitor = pcapvt->pcamonitor;
(pcamonitor->callback)(pcamonitor, pcamonitor->inputIndex, pdata->value);
}
LOCAL void recWaitCaStart(void)
{
FASTLOCKINIT(&lock);
if((ringQ = rngCreate(sizeof(void *) * QUEUE_SIZE)) == NULL) {
errMessage(0,"recWaitCaStart failed");
exit(1);
}
taskid = taskSpawn("recWaitCaTask",CA_CLIENT_PRI-1,VX_FP_TASK,
CA_CLIENT_STACK,(FUNCPTR)recWaitCaTask,0,0,0,0,0,0,0,0,0,0);
if(taskid==ERROR) {
errMessage(0,"recWaitCaStart: taskSpawn Failure\n");
}
}
long recWaitCaAdd(RECWAITCA *pcamonitor)
{
CAPVT *pcapvt;
if(!taskid) recWaitCaStart();
FASTLOCK(&lock);
pcapvt = pcamonitor->recWaitCaPvt;
if(pcapvt == NULL) {
pcapvt = calloc(1,sizeof(CAPVT));
pcamonitor->recWaitCaPvt = pcapvt;
pcapvt->pcamonitor = pcamonitor;
}
pcapvt->cmd = cmdAdd;
if(rngBufPut(ringQ,(void *)&pcapvt,sizeof(pcapvt))
!=sizeof(pcamonitor)) errMessage(0,"recWaitCaAdd: rngBufPut error");
FASTUNLOCK(&lock);
}
long recWaitCaDelete(RECWAITCA *pcamonitor)
{
CAPVT *pcapvt = pcamonitor->recWaitCaPvt;
FASTLOCK(&lock);
pcapvt->cmd = cmdRemove;
if(rngBufPut(ringQ,(void *)&pcapvt,sizeof(pcapvt))
!=sizeof(pcamonitor)) errMessage(0,"recWaitCaDelete: rngBufPut error");
FASTUNLOCK(&lock);
}
/*LOCAL */
void recWaitCaTask(void)
{
CAPVT *pcapvt;
RECWAITCA *pcamonitor;
int status;
taskwdInsert(taskIdSelf(),NULL,NULL);
SEVCHK(ca_task_initialize(),"ca_task_initialize");
while(TRUE) {
while (rngNBytes(ringQ)>=sizeof(pcapvt) && interruptAccept){
if(rngBufGet(ringQ,(void *)&pcapvt,sizeof(pcapvt))
!=sizeof(pcapvt)) {
errMessage(0,"recWaitCaTask: rngBufGet error");
continue;
}
FASTLOCK(&lock);
pcamonitor = pcapvt->pcamonitor;
if(pcapvt->cmd==cmdAdd) {
if(pcapvt->hasMonitor
&& (strcmp(pcamonitor->channame,ca_name(pcapvt->chid))!=0)) {
SEVCHK(ca_clear_channel(pcapvt->chid),"ca_clear_channel");
pcapvt->hasMonitor = FALSE;
}
if(!pcapvt->hasMonitor) {
SEVCHK(ca_build_and_connect(pcamonitor->channame,
TYPENOTCONN,0,&pcapvt->chid,0,NULL,pcapvt),
"ca_build_and_connect");
SEVCHK(ca_add_event(DBR_STS_DOUBLE,pcapvt->chid,
eventCallback,pcapvt,&pcapvt->evid),
"ca_add_event");
pcapvt->hasMonitor = TRUE;
}
} else if (pcapvt->cmd==cmdRemove && pcapvt->hasMonitor) {
SEVCHK(ca_clear_channel(pcapvt->chid),"ca_clear_channel");
pcapvt->hasMonitor = FALSE;
}
FASTUNLOCK(&lock);
}
status = ca_pend_event(.1);
if(status!=ECA_NORMAL && status!=ECA_TIMEOUT)
SEVCHK(status,"ca_pend_event");
}
}
static void myCallback(struct recWaitCa *pcamonitor, char inputIndex, double monData)
{
printf("myCallback: %s index=%d\n",pcamonitor->channame,
pcamonitor->inputIndex);
}
int testCaMonitor(char *name,char *name2,int delay)
{
RECWAITCA *pcamonitor;
long status;
pcamonitor = calloc(1,sizeof(RECWAITCA));
pcamonitor->channame = calloc(1,100);
pcamonitor->callback = myCallback;
strcpy(pcamonitor->channame,name);
status = recWaitCaAdd(pcamonitor);
if(status) errMessage(status,"testCaMonitor error");
taskDelay(10);
status = recWaitCaDelete(pcamonitor);
if(status) errMessage(status,"testCaMonitor error");
if(delay>0) taskDelay(delay);
status = recWaitCaAdd(pcamonitor);
if(status) errMessage(status,"testCaMonitor error");
taskDelay(10);
status = recWaitCaDelete(pcamonitor);
if(status) errMessage(status,"testCaMonitor error");
if(delay>0) taskDelay(delay);
if(name2) strcpy(pcamonitor->channame,name2);
status = recWaitCaAdd(pcamonitor);
if(status) errMessage(status,"testCaMonitor error");
taskDelay(10);
status = recWaitCaDelete(pcamonitor);
if(status) errMessage(status,"testCaMonitor error");
if(delay>0) taskDelay(delay);
return(0);
}

10
src/rec/recWaitCa.h Normal file
View File

@@ -0,0 +1,10 @@
typedef struct recWaitCa{
char *channame;
char inputIndex;
void (*callback)(struct recWaitCa *pcamonitor, char inputIndex, double monData);
void *userPvt;
void *recWaitCaPvt;
} RECWAITCA;
long recWaitCaAdd(RECWAITCA *pcamonitor);
long recWaitCaDelete(RECWAITCA *pcamonitor);

View File

@@ -52,7 +52,6 @@
static char *sccsId = "%W% %G%";
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>

View File

@@ -91,7 +91,7 @@ FAST int sock;
IPPROTO_TCP,
TCP_NODELAY,
(char *)&true,
sizeof true);
sizeof(true));
if(status == ERROR){
logMsg("CAS: TCP_NODELAY option set failed\n",
NULL,
@@ -114,7 +114,7 @@ FAST int sock;
SOL_SOCKET,
SO_KEEPALIVE,
(char *)&true,
sizeof true);
sizeof(true));
if(status == ERROR){
logMsg("CAS: SO_KEEPALIVE option set failed\n",
NULL,

View File

@@ -46,7 +46,6 @@
static char *sccsId = "@(#) $Id$";
#include <stdio.h>
#include <assert.h>
#include <unistd.h>
#include <vxWorks.h>

View File

@@ -58,7 +58,6 @@
static char *sccsId = "@(#) $Id$";
#include <assert.h>
#include <string.h>
#include <vxWorks.h>

View File

@@ -38,7 +38,6 @@ static char *sccsId = "@(#) $Id$";
/*
* ansi includes
*/
#include <assert.h>
#include <string.h>
/*

View File

@@ -55,6 +55,8 @@ typedef int SOCKET;
#define APIENTRY
#include <epicsAssert.h>
#include <vxLib.h>
#include <ellLib.h>
#include <fast_lock.h>

View File

@@ -27,7 +27,7 @@
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif TRUE
#endif /* TRUE */
int debug_print_opt = 0; /* Debug level (set by source file) */
@@ -166,7 +166,7 @@ char *db_name; /* ptr to db name */
#ifdef DEBUG
fprintf(stderr, "assign_stmt: name=%s, db_name=%s\n", name, db_name);
#endif DEBUG
#endif /* DEBUG */
/* Find the variable */
vp = (Var *)findVar(name);
if (vp == 0)
@@ -366,7 +366,7 @@ Expr *prog_list;
ss_list = prog_list;
#ifdef DEBUG
fprintf(stderr, "----Phase2---\n");
#endif DEBUG
#endif /* DEBUG */
phase2(ss_list);
exit(0);
@@ -442,7 +442,7 @@ Expr *ep2; /* beginning 2-nd (append it to 1-st) */
break;
}
fprintf(stderr, ")\n");
#endif DEBUG
#endif /* DEBUG */
return ep1;
}

View File

@@ -131,7 +131,7 @@ reconcile_variables()
{
#ifdef DEBUG
fprintf(stderr, "reconcile_variables: ss=%s\n", ssp->value);
#endif DEBUG
#endif /* DEBUG */
traverseExprTree(ssp, E_VAR, 0, connect_variable, 0);
}

View File

@@ -41,6 +41,7 @@
#define ANSI
#include "seq.h"
#include <string.h>
LOCAL VOID *getPtrToValue(union db_access_val *, chtype);
@@ -68,7 +69,7 @@ SPROG *pSP;
{
#ifdef DEBUG
printf("connect to \"%s\"\n", pDB->db_name);
#endif DEBUG
#endif /* DEBUG */
/* Connect to it */
status = ca_build_and_connect(
pDB->db_name, /* DB channel name */
@@ -119,7 +120,7 @@ struct event_handler_args args;
/* Copy value returned into user variable */
pVal = getPtrToValue((union db_access_val *)args.dbr, pDB->get_type);
nbytes = pDB->size * pDB->count;
bcopy(pVal, pDB->var, nbytes);
memcpy(pDB->var, pVal, nbytes);
/* Copy status & severity */
dbr_sts_ptr = (struct dbr_sts_char *)args.dbr;
@@ -155,7 +156,7 @@ SPROG *pSP;
{
#ifdef DEBUG
printf("disconnect \"%s\"\n", pDB->db_name);
#endif DEBUG
#endif /* DEBUG */
/* Disconnect this channel */
status = ca_clear_channel(pDB->chid);
@@ -206,7 +207,7 @@ struct connection_handler_args args;
pSP->conn_count--;
#ifdef DEBUG
seq_log(pSP, "Channel \"%s\" disconnected\n", pDB->db_name);
#endif DEBUG
#endif /* DEBUG */
}
else
{
@@ -214,14 +215,14 @@ struct connection_handler_args args;
pSP->conn_count++;
#ifdef DEBUG
seq_log(pSP, "Channel \"%s\" connected\n", pDB->db_name);
#endif DEBUG
#endif /* DEBUG */
if (pDB->count > ca_element_count(args.chid))
{
pDB->count = ca_element_count(args.chid);
#ifdef DEBUG
seq_log(pSP, "\"%s\": reset count to %d\n",
pDB->db_name, pDB->count);
#endif DEBUG
#endif /* DEBUG */
}
}
@@ -355,7 +356,7 @@ struct event_handler_args args;
/* Copy value returned into user variable */
pVal = getPtrToValue((union db_access_val *)args.dbr, pDB->get_type);
nbytes = pDB->size * pDB->count;
bcopy(pVal, pDB->var, nbytes);
memcpy(pDB->var, pVal, nbytes);
/* Copy status & severity */
dbr_sts_ptr = (struct dbr_sts_char *)args.dbr;
@@ -404,7 +405,7 @@ CHAN *pDB; /* ptr to channel struct */
pDB->db_name, status);
seq_log(pSP, " put_type=%d\n", pDB->put_type);
seq_log(pSP, " size=%d, count=%d\n", pDB->size, pDB->count);
#endif DEBUG
#endif /* DEBUG */
}
return status;
@@ -422,7 +423,7 @@ CHAN *pDB; /* ptr to channel struct */
#ifdef DEBUG
printf("monitor \"%s\"\n", pDB->db_name);
#endif DEBUG
#endif /* DEBUG */
if (pDB->monitored)
return;

View File

@@ -14,6 +14,7 @@
***************************************************************************/
#define ANSI
#include "seq.h"
#include <string.h>
LOCAL int macNameLth(char *);
LOCAL int seqMacParseName(char *);
@@ -164,7 +165,7 @@ SPROG *pSP;
name = seqAlloc(pSP, nChar+1);
if (name == NULL)
break;
bcopy(pMacStr, name, nChar);
memcpy(name, pMacStr, nChar);
name[nChar] = 0;
#ifdef DEBUG
printf("name=%s, nChar=%d\n", name, nChar);
@@ -198,7 +199,7 @@ SPROG *pSP;
value = seqAlloc(pSP, nChar+1);
if (value == NULL)
break;
bcopy(pMacStr, value, nChar);
memcpy(value, pMacStr, nChar);
value[nChar] = 0;
pMacStr += nChar;
#ifdef DEBUG

View File

@@ -101,7 +101,7 @@ int stack_size; /* optional stack size (bytes) */
#ifdef DEBUG
print_sp_info(pSP_orig);
#endif DEBUG
#endif /* DEBUG */
/* Spawn the sequencer auxillary task */
if (seqAuxTaskId == 0)
@@ -220,7 +220,7 @@ SPROG *pSP_orig; /* original state program structure */
user_size, mac_size, scr_size);
printf(" size=%d=0x%x\n", size, size);
printf(" dyn_ptr=%d=0x%x\n", dyn_ptr, dyn_ptr);
#endif DEBUG
#endif /* DEBUG */
/* Set ptrs in the PROG structure */
pSP_new = (SPROG *)dyn_ptr;

View File

@@ -338,7 +338,7 @@ int tid;
/* Remove tasks' watchdog & suspend all state set tasks except self */
#ifdef DEBUG
logMsg(" Suspending state set tasks:\n");
#endif DEBUG
#endif /*DEBUG */
pSS = pSP->sscb;
for (nss = 0; nss < pSP->nss; nss++, pSS++)
{
@@ -351,7 +351,7 @@ int tid;
{
#ifdef DEBUG
logMsg(" suspend task: tid=%d\n", tid_ss);
#endif DEBUG
#endif /*DEBUG */
taskSuspend(tid_ss);
}
}
@@ -364,7 +364,7 @@ int tid;
{
#ifdef DEBUG
logMsg(" Call exit function\n");
#endif DEBUG
#endif /*DEBUG */
pSP->exit_func(pSP, pSP->user_area);
}
@@ -382,7 +382,7 @@ int tid;
{
#ifdef DEBUG
logMsg("Closing log fd=%d\n", pSP->logFd);
#endif DEBUG
#endif /*DEBUG */
close(pSP->logFd);
pSP->logFd = ioGlobalStdGet(1);
}
@@ -399,7 +399,7 @@ int tid;
{
#ifdef DEBUG
logMsg(" delete ss task: tid=%d\n", tid_ss);
#endif DEBUG
#endif /*DEBUG */
taskDelete(tid_ss);
}
@@ -417,7 +417,7 @@ int tid;
/* Free the memory that was allocated for the task area */
#ifdef DEBUG
logMsg("free pSP->dyn_ptr=0x%x\n", pSP->dyn_ptr);
#endif DEBUG
#endif /*DEBUG */
taskDelay(5);
free(pSP->dyn_ptr);

View File

@@ -31,12 +31,13 @@
*/
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include "parse.h"
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif TRUE
#endif /* TRUE */
extern int line_num; /* input file line no. */
%}

View File

@@ -95,7 +95,7 @@ FPNUM (\-?(([0-9]+)(\.[0-9]*)?)|(\.[0-9]+))
line_num++;
}
<PP>{FPNUM} { nc = strlen(yytext);
bcopy(yytext, str_next, nc+1);
memcpy(str_next, yytext, nc+1);
yylval.pchar = str_next;
str_next += nc+1;
RETURN(NUMBER);

View File

@@ -16,6 +16,7 @@
extern char *sncVersion; /* snc version and date created */
#include <stdio.h>
#include <string.h>
#ifndef TRUE
#define TRUE 1
@@ -200,9 +201,9 @@ char *s;
int ls;
ls = strlen(s);
bcopy(s, in_file, ls);
memcpy(in_file, s, ls);
in_file[ls] = 0;
bcopy(s, out_file, ls);
memcpy(out_file, s, ls);
if ( strcmp(&in_file[ls-3], ".st") == 0 )
{
out_file[ls-2] = 'c';

View File

@@ -2,7 +2,6 @@ EPICS = ../../../../..
include Target.include
include $(EPICS)/config/CONFIG_BASE
CMPLR = OLD
USR_LDLIBS = -lm -s
USR_CFLAGS = -D_NO_PROTO

View File

@@ -40,7 +40,7 @@ char *st_cptr;
{
register char *s;
if (st_line == 0) return;
if (st_line == 0) return(0);
for (s = st_line; *s != '\n'; ++s)
{
if (isprint(*s) || *s == '\t')
@@ -58,6 +58,7 @@ char *st_cptr;
}
putc('^', stderr);
putc('\n', stderr);
return(0);
}

View File

@@ -71,7 +71,7 @@ int k;
}
onintr()
void onintr(int StupidInconsistantSignalTypes)
{
done(1);
}
@@ -118,7 +118,7 @@ char *argv[];
case '\0':
input_file = stdin;
if (i + 1 < argc) usage();
return;
return(0);
case '-':
++i;
@@ -203,6 +203,8 @@ end_of_option:;
no_more_options:;
if (i + 1 != argc) usage();
input_file_name = argv[i];
return(0);
}

View File

@@ -377,7 +377,7 @@ int default_state;
if (to_state[i] != default_state)
++count;
}
if (count == 0) return;
if (count == 0) return(0);
symno = symbol_value[symbol] + 2*nstates;
@@ -395,6 +395,7 @@ int default_state;
tally[symno] = count;
width[symno] = sp1[-1] - sp[0] + 1;
return(0);
}
sort_actions()
@@ -836,7 +837,7 @@ output_stored_text()
open_error(text_file_name);
in = text_file;
if ((c = getc(in)) == EOF)
return;
return(0);
out = code_file;
if (c == '\n')
++outline;
@@ -849,6 +850,8 @@ output_stored_text()
}
if (!lflag)
fprintf(out, line_format, ++outline + 1, code_file_name);
return(0);
}
@@ -1082,7 +1085,7 @@ output_trailing_text()
register FILE *in, *out;
if (line == 0)
return;
return(0);
in = input_file;
out = code_file;
@@ -1091,7 +1094,7 @@ output_trailing_text()
{
++lineno;
if ((c = getc(in)) == EOF)
return;
return(0);
if (!lflag)
{
++outline;
@@ -1130,6 +1133,8 @@ output_trailing_text()
}
if (!lflag)
fprintf(out, line_format, ++outline + 1, code_file_name);
return(0);
}
@@ -1144,7 +1149,7 @@ output_semantic_actions()
open_error(action_file_name);
if ((c = getc(action_file)) == EOF)
return;
return(0);
out = code_file;
last = c;
@@ -1167,6 +1172,8 @@ output_semantic_actions()
if (!lflag)
fprintf(out, line_format, ++outline + 1, code_file_name);
return(0);
}

View File

@@ -60,7 +60,7 @@ get_line()
if (line) { FREE(line); line = 0; }
cptr = 0;
saw_eof = 1;
return;
return(0);
}
if (line == 0 || linesize != (LINESIZE + 1))
@@ -76,7 +76,7 @@ get_line()
for (;;)
{
line[i] = c;
if (c == '\n') { cptr = line; return; }
if (c == '\n') { cptr = line; return(0); }
if (++i >= linesize)
{
linesize += LINESIZE;
@@ -89,7 +89,7 @@ get_line()
line[i] = '\n';
saw_eof = 1;
cptr = line;
return;
return(0);
}
}
}
@@ -128,7 +128,7 @@ skip_comment()
{
cptr = s + 2;
FREE(st_line);
return;
return(0);
}
if (*s == '\n')
{
@@ -284,14 +284,14 @@ copy_ident()
if (c == '\n')
{
fprintf(f, "\"\n");
return;
return(0);
}
putc(c, f);
if (c == '"')
{
putc('\n', f);
++cptr;
return;
return(0);
}
}
}
@@ -416,7 +416,7 @@ loop:
if (need_newline) putc('\n', f);
++cptr;
FREE(t_line);
return;
return(0);
}
/* fall through */
@@ -468,7 +468,7 @@ loop:
{
fprintf(text_file, " YYSTYPE;\n");
FREE(u_line);
return;
return(0);
}
goto loop;
@@ -850,7 +850,7 @@ int assoc;
else if (c == '\'' || c == '"')
bp = get_literal();
else
return;
return(0);
if (bp == goal) tokenized_start(bp->name);
bp->class = TERM;
@@ -905,7 +905,7 @@ declare_types()
else if (c == '\'' || c == '"')
bp = get_literal();
else
return;
return(0);
if (bp->tag && tag != bp->tag)
retyped_warning(bp->name);
@@ -948,7 +948,7 @@ read_declarations()
switch (k = keyword())
{
case MARK:
return;
return(0);
case IDENT:
copy_ident();
@@ -1163,7 +1163,7 @@ add_symbol()
end_rule();
start_rule(bp, s_lineno);
++cptr;
return;
return(0);
}
if (last_was_action)
@@ -1305,7 +1305,7 @@ loop:
case ';':
if (depth > 0) goto loop;
fprintf(f, "\nbreak;\n");
return;
return(0);
case '{':
++depth;
@@ -1314,7 +1314,7 @@ loop:
case '}':
if (--depth > 0) goto loop;
fprintf(f, "\nbreak;\n");
return;
return(0);
case '\'':
case '"':
@@ -1480,7 +1480,7 @@ free_tags()
{
register int i;
if (tag_table == 0) return;
if (tag_table == 0) return(0);
for (i = 0; i < ntags; ++i)
{
@@ -1488,6 +1488,7 @@ free_tags()
FREE(tag_table[i]);
}
FREE(tag_table);
return(0);
}
@@ -1723,7 +1724,7 @@ print_grammar()
int spacing;
register FILE *f = verbose_file;
if (!vflag) return;
if (!vflag) return(0);
k = 1;
for (i = 2; i < nrules; ++i)
@@ -1750,6 +1751,7 @@ print_grammar()
++k;
putc('\n', f);
}
return(0);
}

View File

@@ -8,7 +8,7 @@ verbose()
{
register int i;
if (!vflag) return;
if (!vflag) return(0);
null_rules = (short *) MALLOC(nrules*sizeof(short));
if (null_rules == 0) no_space();
@@ -22,9 +22,10 @@ verbose()
if (SRtotal || RRtotal)
log_conflicts();
fprintf(verbose_file, "\n\n%d terminals, %d nonterminals\n", ntokens,
nvars);
fprintf(verbose_file, "\n\n%d terminals, %d nonterminals\n", ntokens, nvars);
fprintf(verbose_file, "%d grammar rules, %d states\n", nrules - 2, nstates);
return(0);
}

View File

@@ -2,7 +2,8 @@ EPICS = ../../../../..
include Target.include
include $(EPICS)/config/CONFIG_BASE
CMPLR = OLD
CMPLR = STRICT
YACC = $(EYACC)
YACCOPT = -l -d
@@ -10,7 +11,7 @@ SKELETON_FILE=include/flex.skel.static
ifeq ($(T_A),hp700)
USR_CFLAGS = -DDEFAULT_SKELETON_FILE=\"$(SKELETON_FILE)\" -DSCO_UNIX
else
USR_CFLAGS = -DDEFAULT_SKELETON_FILE=\"$(SKELETON_FILE)\"
USR_CFLAGS = -DDEFAULT_SKELETON_FILE=\"$(SKELETON_FILE)\" -DUSG
endif
USR_LDLIBS = -s

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