11
EPICS Workshop 200 3 Dirk Zimoch 1 StreamDevice 2.0 A Multi-Purpose Character Driver for EPICS 3.14

EPICS Workshop 2003Dirk Zimoch 1 StreamDevice 2.0 A Multi-Purpose Character Driver for EPICS 3.14

Embed Size (px)

Citation preview

Page 1: EPICS Workshop 2003Dirk Zimoch 1 StreamDevice 2.0 A Multi-Purpose Character Driver for EPICS 3.14

EPICS Workshop 2003 Dirk Zimoch 1

StreamDevice 2.0

A Multi-Purpose Character Driver

for EPICS 3.14

Page 2: EPICS Workshop 2003Dirk Zimoch 1 StreamDevice 2.0 A Multi-Purpose Character Driver for EPICS 3.14

EPICS Workshop 2003 Dirk Zimoch 2

What´s cool

• Protocol controlled character I/O

• Support new devices by easy configuration

• Modular design allows to support– any record type (with device support)– new I/O hardware– exotic data formats– user defined functions

Page 3: EPICS Workshop 2003Dirk Zimoch 1 StreamDevice 2.0 A Multi-Purpose Character Driver for EPICS 3.14

EPICS Workshop 2003 Dirk Zimoch 3

What´s new

• Using R3.14 OSI libraries– can run on a PC

• Using C++– modules with well-defined interfaces– plug in your own modules

• New protocol features– exception handlers– pre/post processing

Page 4: EPICS Workshop 2003Dirk Zimoch 1 StreamDevice 2.0 A Multi-Purpose Character Driver for EPICS 3.14

EPICS Workshop 2003 Dirk Zimoch 4

Applications

• GPIB devices

• Serial line devices

• Network devices

• Logging to files

• Console I/O

• Client/Server Applications

Page 5: EPICS Workshop 2003Dirk Zimoch 1 StreamDevice 2.0 A Multi-Purpose Character Driver for EPICS 3.14

EPICS Workshop 2003 Dirk Zimoch 5

Protocol File

• Plain text configuration

• One file per device type

• One protocol per function

• Simple commands– in string;– out string;– wait timeout;– event timeout;

Page 6: EPICS Workshop 2003Dirk Zimoch 1 StreamDevice 2.0 A Multi-Purpose Character Driver for EPICS 3.14

EPICS Workshop 2003 Dirk Zimoch 6

I/O Formatting

printf/scanf-like format strings

• standard formats (%f, %d, %s, …)

• additional formats– %b binary (ASCII 0 and 1)– %r raw (two´s complement number)– %D BCD– %{…|…} enumeration

• user defined (exotic) formats

Page 7: EPICS Workshop 2003Dirk Zimoch 1 StreamDevice 2.0 A Multi-Purpose Character Driver for EPICS 3.14

EPICS Workshop 2003 Dirk Zimoch 7

Exception Handlers

Do something special in a special situation

• onError– when input doesn’t match

• onReplyTimeout– when device doesn’t answer

• onInit (not really an exception :-)– when processed during initialisation

Page 8: EPICS Workshop 2003Dirk Zimoch 1 StreamDevice 2.0 A Multi-Purpose Character Driver for EPICS 3.14

EPICS Workshop 2003 Dirk Zimoch 8

Protocol Examples

terminator = CR LF;

get_freq {out "FREQ?"; in "FREQ %f HZ";}

set_freq {out "FREQ %f HZ";

onInit {out "FREQ?"; in "FREQ %f HZ";} }

generic_read {out "%s"; in "%39c";}

# parameter \$1: switch number

set_switch {out "SW \$1 %{OFF|ON}";}

# exotic formats (..!!...!..!)

get_status {out "ST"; in "%11B.!";}

Page 9: EPICS Workshop 2003Dirk Zimoch 1 StreamDevice 2.0 A Multi-Purpose Character Driver for EPICS 3.14

EPICS Workshop 2003 Dirk Zimoch 9

I/O Link

Record link INP or OUT contains

• Name of I/O channel (bus)

• Name of protocol file and protocol

• Protocol parameters (optional)

• I/O-hardware dependent parametersfield (DTYP, "stream")field (OUT, "@gpib1 mydevice set_switch(2) 7")

channel filename protocol protocol parameter

I/O parameter

Page 10: EPICS Workshop 2003Dirk Zimoch 1 StreamDevice 2.0 A Multi-Purpose Character Driver for EPICS 3.14

EPICS Workshop 2003 Dirk Zimoch 10

Pre/Post Processing

Apply user defined functions to output/input

• checksumsout checksum("value %f");in verify("%20c" 0 skip);

• encryptionout "password " scramble("%s");

• additional informationout date("\%H:\%m:\%s") " X = %f";

Page 11: EPICS Workshop 2003Dirk Zimoch 1 StreamDevice 2.0 A Multi-Purpose Character Driver for EPICS 3.14

EPICS Workshop 2003 Dirk Zimoch 11

Work in Process

• Support of new asynDriver– standardised character driver interface

• Implementation of new protocol features

• Debugging

• Documentation

Release this summermailto: [email protected]