PAUL SCHERRER INSTITUT
EPICS at PSI
PSI HomeEPICS HomeSLS HomeSLS Live Status

EPICS

EPICS at SLS
Software
Help
Training
Google

web epics.web.psi.ch

Author: Dirk Zimoch
Phone: +41 56 310 5182
Updated: 13.11.2012


Printer friendly version
 

StreamDevice 2

Contents

What is StreamDevice?

StreamDevice is a generic EPICS device support for devices with a "byte stream" based communication interface. That means devices that can be controlled by sending and receiving strings (in the broadest sense, including non-printable characters and even null-bytes). Examples for this type of communication interface are serial line (RS-232, RS-485, ...), IEEE-488 (also known as GPIB or HP-IB), and TCP/IP. StreamDevice comes with an interface to asynDriver, which implements the low-level support for those communication interfaces. But it can be extended to support other bus drivers.

StreamDevice supports all standard records of EPICS base which can have device support. It is also possible to write support for new record types.

The driver has originally been developped at DELTA in 1999. Version 2 has been completely rewritten for EPICS 3.14. But with some tweaks, it also runs on 3.13.7 or higher. It supports many new features and its new API structure makes it easier to add new formats, bus interfaces, etc.

StreamDevice 2 has been tested on:

  • linux-x86 (RH-7.3, RH-9.0, SL-3, SL-5, SL-6, FC-3, FC-5, FC-6)
  • solaris-sparc and solaris-sparc-gnu (SunOS 5.8)
  • cygwin-x86 (Windows XP, cygwin 1.5.20)
  • win32-x86 (Windows XP)
  • vxWorks-ppc603 (Tornado 2.0.2)
  • vxWorks-ppc604 (Tornado 2.2).
  • RTEMS

Thanks to all testers. Please tell me experiences or problems with other operating systems. Also send me a mail if compilation generates any errors or warnings.

Read the full documentation. (The Programmer's Guide is not yet complete but growing.)

Download

If applying patches, always apply older patches of the same version first (top-down in the list). A newer version always contains all patches from older versions. The CVS snapshot contains all patches but may be instable. Also see the bug table below.

Version 2.6: (Release Notes)
StreamDevice-2-6.tgz
StreamDevice-2-6-patch20121003
StreamDevice-2-6-patch20121009
StreamDevice-2-6-patch20121113
Version 2.5: (Release Notes)
StreamDevice-2-5.tgz
Version 2.5.10: (Release Notes)
StreamDevice-2-5-10.tgz
Version 2.4: (Release Notes)
StreamDevice-2-4.tgz
StreamDevice-2-4-patch20081002
StreamDevice-2-4-patch20081007
StreamDevice-2-4-patch20100604
Version 2.3: (Release Notes)
StreamDevice-2-3.tgz
StreamDevice-2-3-patch20071107
StreamDevice-2-3-patch20080109
StreamDevice-2-3-patch200802051
StreamDevice-2-3-patch200802052
StreamDevice-2-3-patch20080220
Version 2.2: (Release Notes)
StreamDevice-2-2.tgz
StreamDevice-2-2-patch20070803
StreamDevice-2-2-patch20070808
StreamDevice-2-2-patch20070814
StreamDevice-2-2-patch20070824
StreamDevice-2-2-patch20070827
StreamDevice-2-2-patch20071003
StreamDevice-2-2-patch20071010
StreamDevice-2-2-patch20071011
Version 2.1: (Release Notes)
StreamDevice-2-1.tgz
StreamDevice-2-1-patch20060606
StreamDevice-2-1-patch20060612
StreamDevice-2-1-patch20060614
StreamDevice-2-1-patch200606211
StreamDevice-2-1-patch200606212
StreamDevice-2-1-patch200606213
StreamDevice-2-1-patch20060717
Version 2.0: (Release Notes)
StreamDevice-2-0.tgz
StreamDevice-2-0-patch20060320
StreamDevice-2-0-patch20060419
StreamDevice-2-0-patch20060428
StreamDevice-2-0-patch20060519

Supported Devices at PSI

The following serial devices are supported at PSI. (The list is by far not complete.)

Device Comment
GENESYS Programable Power Supply manufactured by Invensys Lambda Inc.

Feature Requests / Bugs

Request Comment
Documentation is incomplete. See the online help for the most recent documentation.
Port to EPICS R3.13 Included in Version 2.2
Manipulation (calculation, formatting) of protocol arguments in addition to pure textual replacement. Will come in a future version.
Initialize records asynchronously (in parallel). Will come in one of the next versions.
Don't run @init handler if PINI=YES. Rejected. The init handler runs in init_record while PINI=YES processes the record. These are two completely different things.
Bug: Protocol file parse error in line 32 on big endian machines. Fixed in Version 2.1
Bug: Compiler error in ChecksumConverter.cc on 68k architectures. Fixed in Version 2.1
Bug: BCD converter scan does not set value. Fixed in Version 2.1
Bug: Does not compile with sun compiler. Fixed in Version 2.1
Bug: Crashes on CPUs which require aligned data (e.g sparc). Fixed in Version 2.1
Bug: Does not compile with Tornado 2.0 (cygnus-2.7.2-960126) cross compiler. Fixed in Version 2.1
Bug: %[...] converter crashes. Fixed in Version 2.1
Bug: Terminators like CR LF not recognized in CR CR LF in "I/O Intr" mode. Fixed in Version 2.1
Bug: Skipping ("\?") not recorgized in enum format ("%{...}"). Fixed in Version 2.1
Checksum: bitwise not of 8-bit sum. Included in Version 2.1
Bug: Pure virtual function called (sometimes) when @init handler fails. Fixed in Version 2.1
Bug: If an invalid protocol was loaded (and thus records became INVALID) and then a valid protocol is loaded (via streamReload), "I/O Intr" records don't (re)start. Fixed in Version 2.1
Enhanced %(FIELD) syntax to allow %(record.FIELD). This allows to distribute input lines with multiple values to many records and to create output lines from many records. Included in Version 2.2
Support for aai and aao records. Included in Version 2.2
New commands: connect and disconnect allow explicit connection status change. Included in Version 2.2
Bug: Deadlock if exec command accesses the same asynDriver port as the calling protocol. Fixed in Version 2.2
Bug: Error message "1 bytes surplus input" if a read waveform contains less elements than NELM. Fixed in Version 2.2
Bug: Setting InTerminator="" for a single protocol does not work. Fixed in Version 2.2
Allow bytes between data and checksum. Implemented in Version 2.2
Port to Windows. Included in Version 2.2
Bug: Bus and Converter registrars are never called when archive libraries are used (when shared libs are disabled). Fixed in Version 2.2
Bug: "asynOverflow" error when from GPIB devices. Fixed in Version 2.2
Bug: Deadlock when reading "I/O Intr" from an asynDriver port where other users do synchronous reads. Fixed in Version 2.2
Port to RTEMS. Included in Version 2.2
Bug: @mismatch handler never called. Fixed in Version 2.2
Bug: streamReload sometimes crashes IOC. Fixed in Version 2.2
StreamDevice should use asynDriver's terminator settings if no terminators are defined in protocol file. Implemented in Version 2.2
Patch for EPICS 3.14.9. Included in Version 2.2
Patches for gcc 4.1.1. Included in Version 2.2
Problems with "I/O Intr" mode. Fixed in Version 2.2
PCRE (Perl compatible regular expressions) %/regex/ patch -p0 < StreamDevice-2-2-patch20070803
Included in Version 2.3
7 bit "xor" checksum %<xor7> patch -p0 < StreamDevice-2-2-patch20070808
Included in Version 2.3
more negative checksums patch -p0 < StreamDevice-2-2-patch20070814
Included in Version 2.3
Early input to "I/O Intr" records (before iocInit) crashes IOC. patch -p0 < StreamDevice-2-2-patch20070824
Fixed in Version 2.3
Skipped charset format %*[charset] does not work and may crash the IOC. patch -p0 < StreamDevice-2-2-patch20070827
Fixed in Version 2.3
Match input against value in record instead of writing it to record field. Patch coming soon. Syntax: e.g %=f.
Build problems with PCRE. Library and/or header file not found. patch -p0 < StreamDevice-2-2-patch20071003
Fixed in Version 2.3
Command disconnect does not work as last command in protocol. patch -p0 < StreamDevice-2-2-patch20071010
Fixed in Version 2.3
Examples and documentation for regular expression matching patch -p0 < StreamDevice-2-2-patch20071011
Included in Version 2.3
@init handlers do not work with vxi11 ports. patch -p0 < StreamDevice-2-3-patch20071107
Fixed in Version 2.4
StreamBuffer::replace(0,n,xxx,0) did not update buffer length. Happens when a variable at the beginning of a string references an emtpy string, e.g.
p {out "\$1 some text";} is used with field(OUT, "@file p() bus")
patch -p0 < StreamDevice-2-3-patch20080109
Fixed in Version 2.4
Better debug message filtering required: multiple debug levels and record name patterns. I really have to do something about this...
Change in "I/O Intr" behaviour: If protocol starts with out
  • Do not send output
  • Observe and match output of other records instead
  • Continue with next command (e.g. in) only on matching output
Have to think about this. It's not backward compatible.
Any comments?
Support for unsigned integers in %r raw converter. patch -p0 < StreamDevice-2-3-patch200802051
Included in Version 2.4
Parser bug in binary format converter %B. patch -p0 < StreamDevice-2-3-patch200802052
Fixed in Version 2.4
Alignment bug in StreamBuffer::reserve() gives problems with redirected formats (%(xxx)...) on machines where alignment matters. patch -p0 < StreamDevice-2-3-patch20080220
Fixed in Version 2.4
Bug: First bit lost in reading binary %b format. New feature: little endian. patch -p0 < StreamDevice-2-3-patch20080222
Fixed in Version 2.4
Bug on vxWorks: Skipped formats (%*...) fail at end of input. Fixed in Version 2.4
Bug in StreamBuffer::find(): 1 byte strings not found. Fixed in Version 2.4
Bug: Stack overflow on vxWorks and RTEMS when reading many lines at once in "I/O Intr" mode. Fixed in Version 2.4
Signed/unsigned conversion problems on 64 bit machines. E.g. ao.RVAL=-1 was printed as 4294967295. Fixed in Version 2.4 : ai.RVAL, ao.RVAL, li.VAL, lo.VAL print correctly with signed integer formats (e.g %d). others (bo.RVAL, mbbo.VAL, mbbo.RVAL, ...) print correctly with unsigned integer formats (e.g %x, %b). Using other signedness may give different results on 32 bit and 64 bit machines.
Bug: Input lost in "I/O Intr" mode when input length > 600 bytes. Fixed in Version 2.4
New format that can parse "-123-2" as -1.23". Included in Version 2.4 : %m
Raw float/double support Included in Version 2.4 : %R
Compile errors on solaris. RawFloatConvert.cc and MantissaExponentConverter.cc don't compile. patch -p0 < StreamDevice-2-4-patch20081002
Skipping string formats %*c or %*s crash ioc when input is empty. patch -p0 < StreamDevice-2-4-patch20081007
Allow missing input to match as zero. E.g. %?d results in 0 if no decimal integer is found. patch -p0 < StreamDevice-2-4-patch20100604
Allow assigned values in enum converter with %#{string=n|...}. Example: %#{neg=-1|pos=1|zero=0} patch -p0 < StreamDevice-2-4-patch20100615

Request a new feature


Author: Dirk Zimoch   Phone: +41 56 310 5182   Email: dirk.zimoch@psi.ch   Updated: 13.11.2012   Source: /afs/psi.ch/project/epics/webhosting/software/streamdevice/index.php