EPICS Collaboration Meeting, June 3, 2010 asynPortDriver C++ Base Class for asyn Port Drivers Mark Rivers University of Chicago Advanced Photon Source.

Slides:



Advertisements
Similar presentations
The ASYN Software Module
Advertisements

1 1999/Ph 514: Channel Access Concepts EPICS Channel Access Concepts Bob Dalesio LANL.
Fall 2014 EPICS Collaboration Meeting, Oct 2014, CEA Saclay, France © 2014, ITER Organization Page 1 Disclaimer: The views and opinions expressed.
EXTERNAL COMMUNICATIONS DESIGNING AN EXTERNAL 3 BYTE INTERFACE Mark Neil - Microprocessor Course 1 External Memory & I/O.
1 Lecture 2: Review of Computer Organization Operating System Spring 2007.
INTEGRATION OF EPICS ASYN INTO NON EPICS ENVIRONMENT PRERANA KANKIYA Brookhaven National Laboratory, New York EPICS COLLABORATION MEETING, 2014.
Managed by UT-Battelle for the Department of Energy Kay Kasemir Sept EPICS EtherIP Driver.
Argonne National Laboratory is managed by The University of Chicago for the U.S. Department of Energy P0 Feedback Project: Merging EPICS with FPGA’s Nicholas.
SLAC asyn class, Day 1, August 26, 2010 Example asyn driver Modbus Mark Rivers, Marty Kraimer, Eric Norum University of Chicago Advanced Photon Source.
I/O Tanenbaum, ch. 5 p. 329 – 427 Silberschatz, ch. 13 p
File System. NET+OS 6 File System Architecture Design Goals File System Layer Design Storage Services Layer Design RAM Services Layer Design Flash Services.
ORNL is managed by UT-Battelle for the US Department of Energy EPICS State Notation Language (SNL), “Sequencer” Kay Kasemir, SNS/ORNL Many slides from.
AreaDetector: Recent Additions and Future Plans Mark Rivers GeoSoilEnviroCARS, Advanced Photon Source University of Chicago.
ICS – Software Engineering Group 1 The SNS General Time Timestamp Driver Sheng Peng & David Thompson.
1 Computer System Overview Chapter 1. 2 n An Operating System makes the computing power available to users by controlling the hardware n Let us review.
Imperial College Tracker Slow Control & Monitoring.
Dirk Zimoch, 2007 Introduction to asynDriver. Page 2Dirk Zimoch, 2007 Introduction to asynDriver What is asynDriver? ■ “asynDriver is a general purpose.
FINAL MPX DELIVERABLE Due when you schedule your interview and presentation.
Marcel Grunder, EPICS Collaboration Meeting October Aerotech A3200 high precision rotation stage Windows based Epics IOC driver implementation.
On-the-fly scanning: Improvements in the EPICS motor and mca modules Mark Rivers University of Chicago.
Conversion to EPICS R3.14 Mark Rivers. New capabilities Progress in converting synApps/GSECARS Outstanding issues Work to be done Outline.
AreaDetector: A new module for EPICS area detector support Mark Rivers GeoSoilEnviroCARS, Advanced Photon Source University of Chicago.
ORNL is managed by UT-Battelle for the US Department of Energy EPICS Automation Kay Kasemir, SNS/ORNL June 2014.
A U.S. Department of Energy Office of Science Laboratory Operated by The University of Chicago Argonne National Laboratory Office of Science U.S. Department.
A U.S. Department of Energy Office of Science Laboratory Operated by The University of Chicago Argonne National Laboratory Office of Science U.S. Department.
1 EPICS Linux Based IOC Support EPICS Meeting at BESSY May 2002 Marty Kraimer.
Area Detector Drivers Towards A Pattern Jon Thompson.
An introduction to areaDetector Tom Cobb. What is areaDetector?  C++ framework for detectors in EPICS  Drivers produces NDArrays of data  Plugins consume.
Processes Introduction to Operating Systems: Module 3.
Integrating EPICS and LabVIEW on Windows using DCOM Freddie Akeroyd ISIS Computing Group.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
Fast Fault Finder A Machine Protection Component.
Control System Overview J. Frederick Bartlett Fermilab June 1,1999.
EPICS to TANGO Translator Rok Šabjan on behalf of Rok Štefanič Presented at ICALEPCS, Knoxville, October.
Motor drivers for asyn motor device support Mark Rivers GeoSoilEnviroCARS, Advanced Photon Source University of Chicago.
Lecture 1: Review of Computer Organization
New IP Drivers using drvIpac Module Driver:CANopen Carrier Driver:GPFC drvIpac ?? CANopen Tip810 CAN Tip810 mv162GPFCatc40vipc310vipc616 Module driver.
An EPICS solution for Galil products that can provide a comprehensive, and high performance motor and PLC control system for use at synchrotrons and other.
Embedded Systems Design 1 Lecture Set 8 MCS-51 Interrupts.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
ASYN Device Support Framework W. Eric Norum
1 Process Description and Control Chapter 3. 2 Process A program in execution An instance of a program running on a computer The entity that can be assigned.
1 Channel Access Concepts – IHEP EPICS Training – K.F – Aug EPICS Channel Access Concepts Kazuro Furukawa, KEK (Bob Dalesio, LANL)
Slides created by: Professor Ian G. Harris Operating Systems  Allow the processor to perform several tasks at virtually the same time Ex. Web Controlled.
EPICS Records J. Frederick Bartlett Fermilab June 1,1999.
Control System Overview J. Frederick Bartlett Fermilab June 1,1999.
Motion Control at the Advanced Photon Source Argonne National Laboratory Mark Rivers University of Chicago 7 GeV synchrotron x-ray light source, the largest.
DEPARTMENT OF ELECTRONICS ENGINEERING V-SEMESTER MICROPROCESSOR & MICROCONTROLLER 1 CHAPTER NO microcontroller & programming.
Lecture 1 Page 1 CS 111 Summer 2013 Important OS Properties For real operating systems built and used by real people Differs depending on who you are talking.
AsynMotor: Support For Coordinated Multi-Axis Motion In EPICS Mark Rivers University of Chicago.
JavaIOC Overview and Update
C++ Base Class for asyn Port Drivers
asyn Training EPICS Collaboration Meeting April 2012
Mark Rivers University of Chicago
C++ Base Class for asyn Port Drivers
Advanced Photon Source
EPICS MCA and Canberra Support
asyn: An Interface Between EPICS Drivers and Clients
Motion Control (at APS)
Human Interface Devices
EPICS asyn Training Classes January 10-12, 2018
CS703 - Advanced Operating Systems
C++ Base Class for asyn Port Drivers
asyn Driver Tutorial Measurement Computing 1608GX-2A0
Advanced Photon Source
Advanced Photon Source
C++ Base Class for asyn Port Drivers
Channel Access Concepts
regDev Simple access to register based devices
Channel Access Concepts
Presentation transcript:

EPICS Collaboration Meeting, June 3, 2010 asynPortDriver C++ Base Class for asyn Port Drivers Mark Rivers University of Chicago Advanced Photon Source

EPICS Collaboration Meeting, June 3, 2010 What is asyn and why to we need it? EPICS IOC architecture Motivation Standard EPICS interface between device support and drivers is only loosely defined Needed custom device support for each driver asyn provides standard interface between device support and device drivers And a lot more too!

EPICS Collaboration Meeting, June 3, 2010 asyn Well defined interface between EPICS device support and driver Standard asyn device support that can be used in nearly all cases In last 8 years I have written many new drivers and I have written NO device support, just use standard asyn device support I believe asyn should be used to write all EPICS device drivers, not just “asynchronous” drivers like serial, GPIB and TCP/IP. –All of my drivers (except one old one) use asyn

EPICS Collaboration Meeting, June 3, 2010 asyn Architecture Device support (or SNL code, another driver, or non-EPICS software) device Port (named object) Port driver addr=0 addr=1 Interfaces (named; pure virtual functions) asynCommon (connect, report, …) asynOctet (write, read, setInputEos,…)

EPICS Collaboration Meeting, June 3, 2010 asynPortDriver New C++ base class that greatly simplifies writing an asyn port driver –Initially developed as part of the areaDetector module, presented at Padova 2008 –Moved from areaDetector into asyn itself in asyn 4-11 –All of my areaDetector, D/A, binary I/O, and most recently motor drivers now use asynPortDriver Hides all details of registering interfaces, registering interrupt sources, doing callbacks, default connection management

EPICS Collaboration Meeting, June 3, 2010 asynPortDriver C++ Base Class Parameter library –Drivers typically need to support a number of parameters that control their operation and provide status information. Most of these can be treated as int32, int32Digital, float64, or strings. Sequence on new value: New parameter value arrives, or new data arrives from device Change values of one or more parameters For each parameter whose value changes set a flag noting that it changed When operation is complete, call the registered callbacks for each changed parameter asynPortDriver provides methods to simplify the above sequence –Each parameter is assigned an index based on the string passed to the driver in the drvUser interface –asynPortDriver has table of parameter values, with data type/asyn interface (int32, float43, etc.), caches the current value, maintains changed flag –Drivers use asynPortDriver methods to read the current value from the table, and to set new values in the table. –Method to call all registered callbacks for values that have changed since callbacks were last done.

EPICS Collaboration Meeting, June 3, 2010 asynPortDriver C++ Methods virtual asynStatus readInt32(asynUser *pasynUser, epicsInt32 *value); virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value); virtual asynStatus readFloat64(asynUser *pasynUser, epicsFloat64 *value); virtual asynStatus writeFloat64(asynUser *pasynUser, epicsFloat64 value); virtual asynStatus readOctet(asynUser *pasynUser, char *value, size_t maxChars, size_t *nActual, int *eomReason); virtual asynStatus writeOctet(asynUser *pasynUser, const char *value, size_t maxChars, size_t *nActual); Drivers typically don’t need to implement the readXXX functions, base class takes care of everything, i.e. get cached value from parameter library Need to implement the writeXXX methods if any immediate action is needed on write, otherwise can use base class implementation which just stores parameter in library

EPICS Collaboration Meeting, June 3, 2010 asynPortDriver C++ Constructor asynPortDriver(const char *portName, int maxAddr, int paramTableSize, int interfaceMask, int interruptMask, int asynFlags, int autoConnect, int priority, int stackSize); portName:Name of this asynPort maxAddr: Number of sub-addresses this driver supports (typically 1) paramTableSize: Number of parameters this driver supports interfaceMask:Bit mask of standard asyn interfaces the driver supports interruptMask: Bit mask of interfaces that will do callbacks to device support asynFlags: ASYN_CANBLOCK, ASYN_MULTIDEVICE autoConnect: Yes/No priority: For port thread if ASYN_CANBLOCK stackSize: For port thread if ASYN_CANBLOCK Based on these arguments base class constructor takes care of all details of registering port driver, registering asyn interfaces, registering interrupt sources, and creating parameter library.

EPICS Collaboration Meeting, June 3, 2010 testAsynPortDriver Digital Oscilloscope Simulator

EPICS Collaboration Meeting, June 3, records (ao, ai, bo, bi, longin, waveform) All input records are I/O Intr scanned Waveform can be switched I/O Intr or periodic Only 340 lines of well-commented C++ code testAsynPortDriver Digital Oscilloscope Simulator

EPICS Collaboration Meeting, June 3, 2010 testAsynPortDriver Database ################################################################### # These records are the time per division # ################################################################### record(ao, "$(P)$(R)TimePerDiv") { field(PINI, "1") field(DTYP, "asynFloat64") field(OUT, field(PREC, "5") } record(ai, "$(P)$(R)TimePerDiv_RBV") { field(DTYP, "asynFloat64") field(INP, field(PREC, "5") field(SCAN, "I/O Intr") } DTYP=asynFloat64, standard asyn device support for ao record drvInfo=SCOPE_TIME_PER_DIV, defines which parameter this record is connected to

EPICS Collaboration Meeting, June 3, 2010 testAsynPortDriver Constructor testAsynPortDriver::testAsynPortDriver(const char *portName, int maxPoints) : asynPortDriver( portName, /* Name of port */ 1, /* maxAddr */ NUM_SCOPE_PARAMS, /* Number of parameters, computed in code */ /* Interface mask */ asynInt32Mask | asynFloat64Mask | asynFloat64ArrayMask | asynDrvUserMask, /* Interrupt mask */ asynInt32Mask | asynFloat64Mask | asynFloat64ArrayMask, /* This driver does not block and it is not multi-device, so flag is 0 */ 0, /* Setting ASYN_CANBLOCK is all that is needed to make an asynchronous driver 1, /* Autoconnect */ 0, /* Default priority */ 0) /* Default stack size*/

EPICS Collaboration Meeting, June 3, 2010 testAsynPortDriver Parameter creation #define P_TimePerDivisionString "SCOPE_TIME_PER_DIV" /* asynFloat64, r/w */ #define P_VoltsPerDivisionString "SCOPE_VOLTS_PER_DIV" /* asynFloat64, r/w */ #define P_VoltOffsetString "SCOPE_VOLT_OFFSET" /* asynFloat64, r/w */ #define P_TriggerDelayString "SCOPE_TRIGGER_DELAY" /* asynFloat64, r/w */ #define P_NoiseAmplitudeString "SCOPE_NOISE_AMPLITUDE" /* asynFloat64, r/w */ #define P_UpdateTimeString "SCOPE_UPDATE_TIME" /* asynFloat64, r/w */ #define P_WaveformString "SCOPE_WAVEFORM" /* asynFloat64Array, r/o */ createParam(P_RunString, asynParamInt32, &P_Run); createParam(P_MaxPointsString, asynParamInt32, &P_MaxPoints); createParam(P_VoltOffsetString, asynParamFloat64, &P_VoltOffset); createParam(P_TriggerDelayString, asynParamFloat64, &P_TriggerDelay); createParam(P_UpdateTimeString, asynParamFloat64, &P_UpdateTime); createParam(P_WaveformString, asynParamFloat64Array, &P_Waveform); createParam(P_TimeBaseString, asynParamFloat64Array, &P_TimeBase); createParam(P_MinValueString, asynParamFloat64, &P_MinValue); createParam(P_MaxValueString, asynParamFloat64, &P_MaxValue); createParam(P_MeanValueString, asynParamFloat64, &P_MeanValue);

EPICS Collaboration Meeting, June 3, 2010 testAsynPortDriver writeFloat64 method asynStatus testAsynPortDriver::writeFloat64(asynUser *pasynUser, epicsFloat64 value) { int function = pasynUser->reason; asynStatus status = asynSuccess; int run; const char *paramName; const char* functionName = "writeFloat64"; /* Set the parameter in the parameter library. */ status = (asynStatus) setDoubleParam(function, value);

EPICS Collaboration Meeting, June 3, 2010 testAsynPortDriver writeFloat64 method if (function == P_UpdateTime) { /* Make sure the update time is valid. * If not change it and put back in parameter library */ if (value < MIN_UPDATE_TIME) { value = MIN_UPDATE_TIME; setDoubleParam(P_UpdateTime, value); } /* If the update time has changed and we are running then wake * up the simulation task */ getIntegerParam(P_Run, &run); if (run) epicsEventSignal(this->eventId); } else { /* All other parameters just get set in parameter list, no need to * act on them here */ } /* Do callbacks so higher layers see any changes */ status = (asynStatus) callParamCallbacks();

EPICS Collaboration Meeting, June 3, 2010 Conclusions Architecture that works well, simplifying task of writing drivers. No device support needed! areaDetector – Talk tomorrow dxp 3-0 – Talk tomorrow Industry Pack drivers ipUnidig binary I/O dac128V D/A module Will use in next generation of motor drivers Easy to implement controller-specific features Coordinated non-linear motion for on-the fly scanning

EPICS Collaboration Meeting, June 3, 2010 Thanks for your attention