Compare commits
23 Commits
Author | SHA1 | Date | |
---|---|---|---|
7a48a5440e | |||
ef5d0cf3f1 | |||
a5e9ed2d78 | |||
40e937b091 | |||
1bac175c42 | |||
507a8229de | |||
3fd2e8fd31 | |||
f2e9395377 | |||
6669b1c33c | |||
21ce272a65 | |||
2b6a064913 | |||
81a901b386 | |||
cfbc4ac369 | |||
d1b6c8bf1a | |||
491cfa6d4b | |||
a6b11bea0e | |||
a6190c7ddf | |||
4ece622c52 | |||
0e525fc893 | |||
85c9a8b130 | |||
905d8a3b4a | |||
1cc5f3fbd6 | |||
3ad63e04d0 |
2
Makefile
2
Makefile
@ -9,7 +9,7 @@ else ifneq ($(wildcard ../config),)
|
|||||||
else
|
else
|
||||||
# Using our own local configuration
|
# Using our own local configuration
|
||||||
TOP = .
|
TOP = .
|
||||||
DIRS = config configure
|
DIRS = configure
|
||||||
src_DEPEND_DIRS := $(DIRS)
|
src_DEPEND_DIRS := $(DIRS)
|
||||||
include $(TOP)/configure/CONFIG
|
include $(TOP)/configure/CONFIG
|
||||||
endif
|
endif
|
||||||
|
@ -14,37 +14,18 @@ TEMPLATE_TOP=$(EPICS_BASE)/templates/makeBaseApp/top
|
|||||||
# define INSTALL_LOCATION_APP here
|
# define INSTALL_LOCATION_APP here
|
||||||
#INSTALL_LOCATION_APP=<fullpathname>
|
#INSTALL_LOCATION_APP=<fullpathname>
|
||||||
|
|
||||||
# For SynApps:
|
SUPPORT=$(TOP)/..
|
||||||
SUPPORT=
|
-include $(TOP)/../configure/SUPPORT.$(EPICS_HOST_ARCH)
|
||||||
|
|
||||||
EPICS_BASE=/usr/local/epics/base-7.0.1
|
ASYN=$(SUPPORT)/asyn4-36
|
||||||
ASYN=~/top-7/asyn4-33
|
CALC=$(SUPPORT)/calc-3-7
|
||||||
CALC=~/top-7/SynApps/calc-2-8
|
PCRE=$(SUPPORT)/pcre-7-2
|
||||||
PCRE=~/top-7/pcre-7-2
|
|
||||||
|
|
||||||
#EPICS_BASE=/usr/local/epics/base-3.16.1
|
# EPICS_BASE usually appears last so other apps can override stuff:
|
||||||
#ASYN=~/top-3.16/asyn4-30
|
EPICS_BASE=/usr/local/epics/base-7.0.3
|
||||||
#CALC=~/top-3.16/SynApps/calc-2-8
|
|
||||||
#PCRE=~/top-3.16/pcre-7-2
|
|
||||||
#PCRE_INCLUDE_SL6-x86=/usr/include
|
|
||||||
#PCRE_INCLUDE_SL6-x86_64=/usr/include
|
|
||||||
#PCRE_INCLUDE_SL6-x86_64-clang=/usr/include
|
|
||||||
|
|
||||||
#EPICS_BASE=/usr/local/epics/base-3.15.5
|
# These lines allow developers to override these RELEASE settings
|
||||||
#ASYN=~/top-3.15/asyn4-30
|
# without having to modify this file directly.
|
||||||
#CALC=~/top-3.15/SynApps/calc-2-8
|
-include $(TOP)/../RELEASE.local
|
||||||
#PCRE=~/top-3.15/pcre-7-2
|
-include $(TOP)/../RELEASE.$(EPICS_HOST_ARCH).local
|
||||||
|
-include $(TOP)/configure/RELEASE.local
|
||||||
#EPICS_BASE=/usr/local/epics/base-3.14.12
|
|
||||||
#ASYN=~/top/asyn4-30
|
|
||||||
#CALC=~/top/SynApps/calc-2-8
|
|
||||||
#PCRE=~/top/pcre-7-2
|
|
||||||
|
|
||||||
#3.14.8 does not understand ~
|
|
||||||
#EPICS_BASE=/usr/local/epics/base-3.14.8
|
|
||||||
#ASYN=/afs/psi.ch/user/z/zimoch/top/asyn-4.10
|
|
||||||
|
|
||||||
##Example 3.13 build
|
|
||||||
#EPICS_BASE=/usr/local/epics/base-3.13.10
|
|
||||||
#ASYN=/afs/psi.ch/user/z/zimoch/top_3.13/4-6
|
|
||||||
#COMPAT=/afs/psi.ch/user/z/zimoch/top_3.13
|
|
||||||
|
@ -120,7 +120,7 @@ Longer code segments are often set in a box.
|
|||||||
<h2>Changes in Version 2.8</h2>
|
<h2>Changes in Version 2.8</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Support standard EPICS module build system.
|
<li>Support standard EPICS module build system.
|
||||||
<li>Compatible with EPICS base releases up to 7.0.1.
|
<li>Compatible with EPICS 7.
|
||||||
<ul>
|
<ul>
|
||||||
<li>Support for new record types: int64in, int64out, lsi, lso.
|
<li>Support for new record types: int64in, int64out, lsi, lso.
|
||||||
<li>Support for INT64 and UINT64 in aai, aao, waveform.
|
<li>Support for INT64 and UINT64 in aai, aao, waveform.
|
||||||
@ -128,7 +128,6 @@ Longer code segments are often set in a box.
|
|||||||
<li>Run @init more often (e.g. when device re-connects or paused IOC is resumed).
|
<li>Run @init more often (e.g. when device re-connects or paused IOC is resumed).
|
||||||
<li>Use "COMM" error code in .STAT when device is disconnected.
|
<li>Use "COMM" error code in .STAT when device is disconnected.
|
||||||
<li>Allow spaces in protocol parameter list.
|
<li>Allow spaces in protocol parameter list.
|
||||||
<li>Errors are new silent by default (var streamError 0) except during init.
|
|
||||||
<li>Support output redirect of all shell functions.
|
<li>Support output redirect of all shell functions.
|
||||||
<li>Fix building shared libraries on Windows.
|
<li>Fix building shared libraries on Windows.
|
||||||
<li>Fix some C++11 warnings.
|
<li>Fix some C++11 warnings.
|
||||||
|
@ -95,6 +95,7 @@ div div div a {list-style-type:circle;}
|
|||||||
<div>
|
<div>
|
||||||
<a target="_parent" href="setup.html#reload">Reloading</a>
|
<a target="_parent" href="setup.html#reload">Reloading</a>
|
||||||
</div>
|
</div>
|
||||||
|
<a target="_parent" href="setup.html#debug">Debugging</a>
|
||||||
<a target="_parent" href="setup.html#rec">Records</a>
|
<a target="_parent" href="setup.html#rec">Records</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -390,6 +390,9 @@ what they influence.
|
|||||||
the moment.
|
the moment.
|
||||||
How many milliseconds to wait after last poll or last received
|
How many milliseconds to wait after last poll or last received
|
||||||
input before polling again?
|
input before polling again?
|
||||||
|
A good value is about half the time of the expected input period.
|
||||||
|
Longer values cause latency and shorter values may increase CPU
|
||||||
|
consumption.
|
||||||
If not set the same value as for <code>ReplyTimeout</code> is
|
If not set the same value as for <code>ReplyTimeout</code> is
|
||||||
used.
|
used.
|
||||||
</dd>
|
</dd>
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<p>
|
<p>
|
||||||
<em>StreamDevice</em> works with
|
<em>StreamDevice</em> works with
|
||||||
<a href="https://epics.anl.gov/base/index.php">EPICS base</a>
|
<a href="https://epics.anl.gov/base/index.php">EPICS base</a>
|
||||||
versions from R3.14.6 on, tested up to 7.0.1.
|
versions from R3.14.6 on, tested up to 7.0.3.
|
||||||
It also works (with limitations) with older
|
It also works (with limitations) with older
|
||||||
<a href="https://epics.anl.gov/base/R3-13.php">R3.13</a>
|
<a href="https://epics.anl.gov/base/R3-13.php">R3.13</a>
|
||||||
versions from R3.13.7 on.
|
versions from R3.13.7 on.
|
||||||
@ -377,8 +377,43 @@ protocol is loaded.
|
|||||||
See the <a href="protocol.html">next chapter</a> for protocol files in depth.
|
See the <a href="protocol.html">next chapter</a> for protocol files in depth.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<a name="debug"></a>
|
||||||
|
<h2>5. Debug and Error Messages</h2>
|
||||||
|
<p>
|
||||||
|
Generation of debug and error messages is controlled with two shell variables,
|
||||||
|
<code>streamDebug</code> and <code>streamError</code>.
|
||||||
|
Setting those variables to 1 (actually to any number but 0) enables the
|
||||||
|
messages.
|
||||||
|
Per default debug messages are switched off and error messages are switched on.
|
||||||
|
Errors occuring while loading protocol files are always shown.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Warning: Enabling debug messages can create a lot of output!
|
||||||
|
At the moment, there is no way to set filters on debug or error messages.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Debug output can be redirected to a file with the command
|
||||||
|
<code>streamSetLogfile("<var>filename</var>")</code>.
|
||||||
|
When called without a filename, debug output is directed back
|
||||||
|
to the console.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h3>Example (vxWorks):</h3>
|
||||||
|
<pre>
|
||||||
|
streamError=1
|
||||||
|
streamDebug=1
|
||||||
|
streamSetLogfile("logfile.txt")
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<h3>Example (iocsh):</h3>
|
||||||
|
<pre>
|
||||||
|
var streamError 1
|
||||||
|
var streamDebug 1
|
||||||
|
streamSetLogfile("logfile.txt")
|
||||||
|
</pre>
|
||||||
|
|
||||||
<a name="rec"></a>
|
<a name="rec"></a>
|
||||||
<h2>5. Configuring the Records</h2>
|
<h2>6. Configuring the Records</h2>
|
||||||
<p>
|
<p>
|
||||||
To tell a record to use <em>StreamDevice</em>, set its <code>DTYP</code> field to
|
To tell a record to use <em>StreamDevice</em>, set its <code>DTYP</code> field to
|
||||||
<code>"stream"</code>.
|
<code>"stream"</code>.
|
||||||
|
@ -21,6 +21,14 @@
|
|||||||
#include "StreamError.h"
|
#include "StreamError.h"
|
||||||
#include "StreamBuffer.h"
|
#include "StreamBuffer.h"
|
||||||
|
|
||||||
|
#include "asynDriver.h"
|
||||||
|
#include "asynOctet.h"
|
||||||
|
#include "asynInt32.h"
|
||||||
|
#include "asynUInt32Digital.h"
|
||||||
|
#include "asynGpibDriver.h"
|
||||||
|
|
||||||
|
#include "devStream.h"
|
||||||
|
|
||||||
#ifdef EPICS_3_13
|
#ifdef EPICS_3_13
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <wdLib.h>
|
#include <wdLib.h>
|
||||||
@ -32,17 +40,9 @@ extern "C" {
|
|||||||
#include "epicsAssert.h"
|
#include "epicsAssert.h"
|
||||||
#include "epicsTime.h"
|
#include "epicsTime.h"
|
||||||
#include "epicsTimer.h"
|
#include "epicsTimer.h"
|
||||||
#include "epicsStdioRedirect.h"
|
|
||||||
#include "iocsh.h"
|
#include "iocsh.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "asynDriver.h"
|
|
||||||
#include "asynOctet.h"
|
|
||||||
#include "asynInt32.h"
|
|
||||||
#include "asynUInt32Digital.h"
|
|
||||||
#include "asynGpibDriver.h"
|
|
||||||
|
|
||||||
#include "devStream.h"
|
|
||||||
#include "MacroMagic.h"
|
#include "MacroMagic.h"
|
||||||
|
|
||||||
#define Z PRINTF_SIZE_T_PREFIX
|
#define Z PRINTF_SIZE_T_PREFIX
|
||||||
|
@ -28,6 +28,12 @@
|
|||||||
#define SCNx8 "hhx"
|
#define SCNx8 "hhx"
|
||||||
#define uint_fast8_t uint8_t
|
#define uint_fast8_t uint8_t
|
||||||
#define int_fast8_t int8_t
|
#define int_fast8_t int8_t
|
||||||
|
#elif defined(_MSC_VER) && _MSC_VER < 1700 /* Visual Studio 2010 does not have inttypes.h */
|
||||||
|
#include <stdint.h>
|
||||||
|
#define PRIX32 "X"
|
||||||
|
#define PRIu32 "u"
|
||||||
|
#define PRIX8 "X"
|
||||||
|
#define SCNx8 "hhx"
|
||||||
#else
|
#else
|
||||||
#define __STDC_FORMAT_MACROS
|
#define __STDC_FORMAT_MACROS
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
@ -37,28 +37,35 @@ _ENUM_CAST(type)
|
|||||||
|
|
||||||
#define _NTH_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, N, ...) N
|
#define _NTH_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, N, ...) N
|
||||||
|
|
||||||
|
/*
|
||||||
|
* we need to use _EXPAND below to work around a problem in Visual Studio 2010
|
||||||
|
* where __VA_ARGS__ is treated as a single argument
|
||||||
|
* See https://stackoverflow.com/questions/5134523/msvc-doesnt-expand-va-args-correctly
|
||||||
|
*/
|
||||||
|
#define _EXPAND( x ) x
|
||||||
|
|
||||||
#define _fe_0(_call, ...)
|
#define _fe_0(_call, ...)
|
||||||
#define _fe_1(_call, x) _call(x)
|
#define _fe_1(_call, x) _call(x)
|
||||||
#define _fe_2(_call, x, ...) _call(x) _fe_1(_call, __VA_ARGS__)
|
#define _fe_2(_call, x, ...) _call(x) _EXPAND(_fe_1(_call, __VA_ARGS__))
|
||||||
#define _fe_3(_call, x, ...) _call(x) _fe_2(_call, __VA_ARGS__)
|
#define _fe_3(_call, x, ...) _call(x) _EXPAND(_fe_2(_call, __VA_ARGS__))
|
||||||
#define _fe_4(_call, x, ...) _call(x) _fe_3(_call, __VA_ARGS__)
|
#define _fe_4(_call, x, ...) _call(x) _EXPAND(_fe_3(_call, __VA_ARGS__))
|
||||||
#define _fe_5(_call, x, ...) _call(x) _fe_4(_call, __VA_ARGS__)
|
#define _fe_5(_call, x, ...) _call(x) _EXPAND(_fe_4(_call, __VA_ARGS__))
|
||||||
#define _fe_6(_call, x, ...) _call(x) _fe_5(_call, __VA_ARGS__)
|
#define _fe_6(_call, x, ...) _call(x) _EXPAND(_fe_5(_call, __VA_ARGS__))
|
||||||
#define _fe_7(_call, x, ...) _call(x) _fe_6(_call, __VA_ARGS__)
|
#define _fe_7(_call, x, ...) _call(x) _EXPAND(_fe_6(_call, __VA_ARGS__))
|
||||||
#define _fe_8(_call, x, ...) _call(x) _fe_7(_call, __VA_ARGS__)
|
#define _fe_8(_call, x, ...) _call(x) _EXPAND(_fe_7(_call, __VA_ARGS__))
|
||||||
#define _fe_9(_call, x, ...) _call(x) _fe_8(_call, __VA_ARGS__)
|
#define _fe_9(_call, x, ...) _call(x) _EXPAND(_fe_8(_call, __VA_ARGS__))
|
||||||
#define _fe_10(_call, x, ...) _call(x) _fe_9(_call, __VA_ARGS__)
|
#define _fe_10(_call, x, ...) _call(x) _EXPAND(_fe_9(_call, __VA_ARGS__))
|
||||||
|
|
||||||
#define MACRO_FOR_EACH(x, ...) \
|
#define MACRO_FOR_EACH(x, ...) \
|
||||||
_NTH_ARG(_, ##__VA_ARGS__, \
|
_EXPAND(_NTH_ARG(_, ##__VA_ARGS__, \
|
||||||
_fe_10, _fe_9, _fe_8, _fe_7, _fe_6, _fe_5, _fe_4, _fe_3, _fe_2, _fe_1, _fe_0) \
|
_fe_10, _fe_9, _fe_8, _fe_7, _fe_6, _fe_5, _fe_4, _fe_3, _fe_2, _fe_1, _fe_0) \
|
||||||
(x, ##__VA_ARGS__)
|
(x, ##__VA_ARGS__))
|
||||||
|
|
||||||
/* Enum to string magic */
|
/* Enum to string magic */
|
||||||
|
|
||||||
#define ENUM(type,...) \
|
#define ENUM(type,...) \
|
||||||
enum type { __VA_ARGS__ }; \
|
enum type { __VA_ARGS__ }; \
|
||||||
static inline const char* type##ToStr(int x) {switch(x){MACRO_FOR_EACH(_CASE_LINE,__VA_ARGS__) default: return "invalid";}} \
|
static inline const char* type##ToStr(int x) {switch(x){_EXPAND(MACRO_FOR_EACH(_CASE_LINE,__VA_ARGS__)) default: return "invalid";}} \
|
||||||
_ENUM_CAST(type)
|
_ENUM_CAST(type)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
10
src/Makefile
10
src/Makefile
@ -100,7 +100,7 @@ STREAM_DBD_FILES = $(LIBRARY_DEFAULT)-base.dbd
|
|||||||
ifdef CALC
|
ifdef CALC
|
||||||
# create stream-scalcout.dbd for scalcout record
|
# create stream-scalcout.dbd for scalcout record
|
||||||
$(COMMON_DIR)/$(LIBRARY_DEFAULT)-scalcout.dbd: ../CONFIG_STREAM
|
$(COMMON_DIR)/$(LIBRARY_DEFAULT)-scalcout.dbd: ../CONFIG_STREAM
|
||||||
$(PERL) ../makedbd.pl $(if $(ASYN),--with-asyn) $(if $(BASE_3_14),,-3.13) scalcout > $@
|
$(PERL) ../makedbd.pl --rec-only scalcout > $@
|
||||||
|
|
||||||
$(LIBRARY_DEFAULT)-scalcout.dbd$(DEP): ../CONFIG_STREAM
|
$(LIBRARY_DEFAULT)-scalcout.dbd$(DEP): ../CONFIG_STREAM
|
||||||
echo $(LIBRARY_DEFAULT)-scalcout.dbd: $< > $@
|
echo $(LIBRARY_DEFAULT)-scalcout.dbd: $< > $@
|
||||||
@ -109,8 +109,8 @@ STREAM_DBD_FILES += $(LIBRARY_DEFAULT)-scalcout.dbd
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# create stream.dbd for all record types
|
# create stream.dbd for all record types
|
||||||
$(COMMON_DIR)/$(LIBRARY_DEFAULT).dbd: $(addprefix $(COMMON_DIR)/, $(STREAM_DBD_FILES))
|
$(COMMON_DIR)/$(LIBRARY_DEFAULT).dbd: ../CONFIG_STREAM
|
||||||
cat $? > $@
|
$(PERL) ../makedbd.pl $(if $(ASYN),--with-asyn) $(if $(BASE_3_14),,-3.13) $(RECORDTYPES) > $@
|
||||||
|
|
||||||
$(LIBRARY_DEFAULT).dbd$(DEP):
|
$(LIBRARY_DEFAULT).dbd$(DEP): ../CONFIG_STREAM
|
||||||
echo "$(LIBRARY_DEFAULT).dbd: $(STREAM_DBD_FILES)" > $@
|
echo $(LIBRARY_DEFAULT).dbd: $< > $@
|
||||||
|
@ -26,6 +26,9 @@ endif
|
|||||||
include $(TOP)/config/CONFIG_APP
|
include $(TOP)/config/CONFIG_APP
|
||||||
include ../CONFIG_STREAM
|
include ../CONFIG_STREAM
|
||||||
|
|
||||||
|
CXXCMPLR=NORMAL
|
||||||
|
G++_NORMAL = $(G++)
|
||||||
|
|
||||||
LIBNAME = streamLib
|
LIBNAME = streamLib
|
||||||
|
|
||||||
SRCS.cc += $(BUSSES:%=../%Interface.cc)
|
SRCS.cc += $(BUSSES:%=../%Interface.cc)
|
||||||
|
@ -447,10 +447,10 @@ finishProtocol(ProtocolResult status)
|
|||||||
debug("StreamCore::finishProtocol(%s, %s) %sbus owner\n",
|
debug("StreamCore::finishProtocol(%s, %s) %sbus owner\n",
|
||||||
name(), toStr(status), flags & BusOwner ? "" : "not ");
|
name(), toStr(status), flags & BusOwner ? "" : "not ");
|
||||||
|
|
||||||
if (flags & BusPending)
|
if (status == Success && flags & BusPending)
|
||||||
{
|
{
|
||||||
error("StreamCore::finishProtocol(%s): Still waiting for %s%s%s\n",
|
error("StreamCore::finishProtocol(%s, %s): Still waiting for %s%s%s\n",
|
||||||
name(),
|
name(), toStr(status),
|
||||||
flags & LockPending ? "lockSuccess() " : "",
|
flags & LockPending ? "lockSuccess() " : "",
|
||||||
flags & WritePending ? "writeSuccess() " : "",
|
flags & WritePending ? "writeSuccess() " : "",
|
||||||
flags & WaitPending ? "timerCallback()" : "");
|
flags & WaitPending ? "timerCallback()" : "");
|
||||||
@ -901,11 +901,10 @@ evalIn()
|
|||||||
debug("StreamCore::evalIn(%s): early input: %s\n",
|
debug("StreamCore::evalIn(%s): early input: %s\n",
|
||||||
name(), inputBuffer.expand()());
|
name(), inputBuffer.expand()());
|
||||||
expectedInput = readCallback(lastInputStatus, NULL, 0);
|
expectedInput = readCallback(lastInputStatus, NULL, 0);
|
||||||
if (!expectedInput)
|
if (expectedInput == 0)
|
||||||
{
|
|
||||||
// no more input needed
|
|
||||||
return true;
|
return true;
|
||||||
}
|
if (expectedInput == -1) // don't know how much
|
||||||
|
expectedInput = 0;
|
||||||
}
|
}
|
||||||
if (flags & AsyncMode)
|
if (flags & AsyncMode)
|
||||||
{
|
{
|
||||||
@ -1078,7 +1077,7 @@ readCallback(StreamIoStatus status,
|
|||||||
if (maxInput)
|
if (maxInput)
|
||||||
return maxInput - inputBuffer.length();
|
return maxInput - inputBuffer.length();
|
||||||
else
|
else
|
||||||
return -1;
|
return -1; // We don't know for how much to wait
|
||||||
}
|
}
|
||||||
// try to parse what we got
|
// try to parse what we got
|
||||||
end = inputBuffer.length();
|
end = inputBuffer.length();
|
||||||
|
@ -63,8 +63,8 @@ extern DBBASE *pdbbase;
|
|||||||
#include "epicsThread.h"
|
#include "epicsThread.h"
|
||||||
#include "epicsString.h"
|
#include "epicsString.h"
|
||||||
#include "registryFunction.h"
|
#include "registryFunction.h"
|
||||||
#include "epicsStdioRedirect.h"
|
|
||||||
#include "iocsh.h"
|
#include "iocsh.h"
|
||||||
|
#include "epicsExport.h"
|
||||||
|
|
||||||
#if defined(VERSION_INT) || EPICS_MODIFICATION >= 11
|
#if defined(VERSION_INT) || EPICS_MODIFICATION >= 11
|
||||||
#include "initHooks.h"
|
#include "initHooks.h"
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int streamDebug = 0;
|
int streamDebug = 0;
|
||||||
int streamError = 0;
|
int streamError = 1;
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
__declspec(dllexport)
|
__declspec(dllexport)
|
||||||
@ -43,6 +43,11 @@ FILE *StreamDebugFile = NULL;
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define localtime_r(timet,tm) localtime_s(tm,timet)
|
#define localtime_r(timet,tm) localtime_s(tm,timet)
|
||||||
|
|
||||||
|
/* this may not be defined if using older Windows SDKs */
|
||||||
|
#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
|
||||||
|
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Enable ANSI colors in Windows console */
|
/* Enable ANSI colors in Windows console */
|
||||||
static int win_console_init() {
|
static int win_console_init() {
|
||||||
DWORD dwMode = 0;
|
DWORD dwMode = 0;
|
||||||
@ -90,7 +95,7 @@ void StreamError(int line, const char* file, const char* fmt, ...)
|
|||||||
void StreamVError(int line, const char* file, const char* fmt, va_list args)
|
void StreamVError(int line, const char* file, const char* fmt, va_list args)
|
||||||
{
|
{
|
||||||
char timestamp[40];
|
char timestamp[40];
|
||||||
if (!streamError) return; // Error logging disabled
|
if (!(streamError || streamDebug)) return; // Error logging disabled
|
||||||
StreamPrintTimestampFunction(timestamp, 40);
|
StreamPrintTimestampFunction(timestamp, 40);
|
||||||
#ifdef va_copy
|
#ifdef va_copy
|
||||||
if (StreamDebugFile)
|
if (StreamDebugFile)
|
||||||
|
@ -26,10 +26,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define STREAM_MAJOR 2
|
#define STREAM_MAJOR 2
|
||||||
#define STREAM_MINOR 8
|
#define STREAM_MINOR 8
|
||||||
|
|
||||||
@ -47,11 +43,16 @@ extern "C" {
|
|||||||
#include "epicsVersion.h"
|
#include "epicsVersion.h"
|
||||||
#ifdef BASE_VERSION
|
#ifdef BASE_VERSION
|
||||||
#define EPICS_3_13
|
#define EPICS_3_13
|
||||||
|
/* EPICS 3.13 include files are not C++ ready. */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef epicsExportSharedSymbols
|
#ifdef epicsExportSharedSymbols
|
||||||
# define devStream_epicsExportSharedSymbols
|
# define devStream_epicsExportSharedSymbols
|
||||||
# undef epicsExportSharedSymbols
|
# undef epicsExportSharedSymbols
|
||||||
|
# include <shareLib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "dbCommon.h"
|
#include "dbCommon.h"
|
||||||
@ -65,10 +66,20 @@ extern "C" {
|
|||||||
#include "epicsMath.h"
|
#include "epicsMath.h"
|
||||||
|
|
||||||
#ifdef devStream_epicsExportSharedSymbols
|
#ifdef devStream_epicsExportSharedSymbols
|
||||||
|
# undef devStream_epicsExportSharedSymbols
|
||||||
# define epicsExportSharedSymbols
|
# define epicsExportSharedSymbols
|
||||||
|
# include <shareLib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#ifdef EPICS_3_13
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#include "epicsStdioRedirect.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
typedef ptrdiff_t ssize_t;
|
typedef ptrdiff_t ssize_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -82,6 +93,10 @@ extern const char StreamVersion [];
|
|||||||
|
|
||||||
typedef long (*streamIoFunction) (dbCommon*, format_t*);
|
typedef long (*streamIoFunction) (dbCommon*, format_t*);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
long streamInit(int after);
|
long streamInit(int after);
|
||||||
long streamInitRecord(dbCommon *record,
|
long streamInitRecord(dbCommon *record,
|
||||||
const struct link *ioLink,
|
const struct link *ioLink,
|
||||||
@ -94,6 +109,10 @@ long streamPrintf(dbCommon *record, format_t *format, ...);
|
|||||||
ssize_t streamScanfN(dbCommon *record, format_t *format,
|
ssize_t streamScanfN(dbCommon *record, format_t *format,
|
||||||
void*, size_t maxStringSize);
|
void*, size_t maxStringSize);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* backward compatibility stuff */
|
/* backward compatibility stuff */
|
||||||
#define streamScanf(record, format, value) \
|
#define streamScanf(record, format, value) \
|
||||||
streamScanfN(record, format, value, MAX_STRING_SIZE)
|
streamScanfN(record, format, value, MAX_STRING_SIZE)
|
||||||
@ -107,8 +126,4 @@ ssize_t streamScanfN(dbCommon *record, format_t *format,
|
|||||||
#include "epicsExport.h"
|
#include "epicsExport.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
if (@ARGV[0] eq "--rec-only") {
|
||||||
|
shift;
|
||||||
|
} else {
|
||||||
if (@ARGV[0] eq "--with-asyn") {
|
if (@ARGV[0] eq "--with-asyn") {
|
||||||
shift;
|
shift;
|
||||||
$asyn = 1;
|
$asyn = 1;
|
||||||
@ -11,6 +14,7 @@ if (@ARGV[0] eq "-3.13") {
|
|||||||
if ($asyn) { print "registrar(AsynDriverInterfaceRegistrar)\n"; }
|
if ($asyn) { print "registrar(AsynDriverInterfaceRegistrar)\n"; }
|
||||||
}
|
}
|
||||||
print "driver(stream)\n";
|
print "driver(stream)\n";
|
||||||
|
}
|
||||||
for (@ARGV) {
|
for (@ARGV) {
|
||||||
print "device($_,INST_IO,dev${_}Stream,\"stream\")\n";
|
print "device($_,INST_IO,dev${_}Stream,\"stream\")\n";
|
||||||
}
|
}
|
||||||
|
1
streamApp/.gitignore
vendored
Normal file
1
streamApp/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
streamAppInclude.dbd
|
@ -7,19 +7,27 @@ include $(TOP)/config/CONFIG_APP
|
|||||||
|
|
||||||
LIBNAME = streamApp
|
LIBNAME = streamApp
|
||||||
|
|
||||||
|
DBD += base-3-13.dbd
|
||||||
|
DBD += stream.dbd
|
||||||
|
|
||||||
LDLIBS += $(TOP)/bin/$(T_A)/streamLib
|
LDLIBS += $(TOP)/bin/$(T_A)/streamLib
|
||||||
|
ifdef ASYN
|
||||||
LDLIBS += $(ASYN)/bin/$(T_A)/asynLib
|
LDLIBS += $(ASYN)/bin/$(T_A)/asynLib
|
||||||
|
DBD += asyn.dbd
|
||||||
|
endif
|
||||||
|
ifdef COMPAT
|
||||||
LDLIBS += $(COMPAT)/bin/$(T_A)/compatLib
|
LDLIBS += $(COMPAT)/bin/$(T_A)/compatLib
|
||||||
|
endif
|
||||||
|
|
||||||
include ../base-3-13LIBOBJS
|
include ../base-3-13LIBOBJS
|
||||||
|
|
||||||
streamApp_DBD += base-3-13.dbd
|
|
||||||
streamApp_DBD += stream.dbd
|
|
||||||
DBDNAME = streamApp.dbd
|
DBDNAME = streamApp.dbd
|
||||||
DBDEXPAND = streamAppInclude-3-13.dbd
|
DBDEXPAND = streamAppInclude.dbd
|
||||||
|
|
||||||
# Write StreamDevice debug output to this file
|
$(DBDNAME): ../$(DBDEXPAND)
|
||||||
#CPPFLAGS += -DDEBUGFILE=StreamDebug.log
|
.PHONY:: ../$(DBDEXPAND)
|
||||||
|
../$(DBDEXPAND):
|
||||||
|
echo -e '$(DBD:%=include "%"\n)' > $@
|
||||||
|
|
||||||
include $(EPICS_BASE)/config/RULES.Vx
|
include $(EPICS_BASE)/config/RULES.Vx
|
||||||
include ../../config/RULES.munch
|
include ../../config/RULES.munch
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
include "base-3-13.dbd"
|
|
||||||
include "asyn.dbd"
|
|
||||||
include "stream.dbd"
|
|
Reference in New Issue
Block a user