EPICS Record/Device/Driver Support Interfaces

Slides:



Advertisements
Similar presentations
Automating Software Module Testing for FAA Certification Usha Santhanam The Boeing Company.
Advertisements

1 2009: Device Support EPICS Device Support Andy Foster Observatory Sciences Limited.
Device Drivers. Linux Device Drivers Linux supports three types of hardware device: character, block and network –character devices: R/W without buffering.
1 1999/Ph 514: Channel Access Concepts EPICS Channel Access Concepts Bob Dalesio LANL.
R4 Dynamically loading processes. Overview R4 is closely related to R3, much of what you have written for R3 applies to R4 In R3, we executed procedures.
EPICS Tutorial - IOC Database Raja Ramanna Centre For Advanced Technology Indore India January Presented by: Marty Kraimer Based on Presentations.
Module R2 CS450. Next Week R1 is due next Friday ▫Bring manuals in a binder - make sure to have a cover page with group number, module, and date. You.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
V4 – Executive Summary 1.Provide online add/delete of I/O to support continuous operation. 2.Provide redundant control of remote I/O to support improved.
Dirk Zimoch, EPICS Meeting April 2007, Hamburg Siemens S7 PLC Communication.
CVSQL 2 The Design. System Overview System Components CVSQL Server –Three network interfaces –Modular data source provider framework –Decoupled SQL parsing.
Operating System Program 5 I/O System DMA Device Driver.
JavaIOC Marty Kraimer EPICS Collaboration Meeting ICALEPCS October
AQS Web Quick Reference Guide Changing Raw Data Values Using Maintenance 1. From Main Menu, click Maintenance, Sample Values, Raw Data 2. Enter monitor.
Copyright © 2007, Oracle. All rights reserved. Managing Concurrent Requests.
ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.
1 Experimental Physics and Industrial Control System (EPICS) Database Bob Dalesio, May 31,2010.
Experimental Physics and Industrial Control System (EPICS) Database Bob Dalesio, June 27,2001.
EPICS devSNMP Extensions Euan Troup, CSIRO Australia Telescope National Facility ASKAP Project Paul Wild Observatory.
Specview 32 Release 2.5 Enhancements
1 1999/Ph 514: Record Support EPICS Record Support Marty Kraimer APS.
Operating Systems Lecture 7 OS Potpourri Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of Software.
1 1999/Ph 514: IOC Development Environment EPICS IOC Development Environment Marty Kraimer APS.
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.
Introduction to Biometrics Dr. Bhavani Thuraisingham The University of Texas at Dallas Lecture #23 Biometrics Standards - II November 14, 2005.
EPICS record/device/driver Support many slides copied from
Device Drivers CPU I/O Interface Device Driver DEVICECONTROL OPERATIONSDATA TRANSFER OPERATIONS Disk Seek to Sector, Track, Cyl. Seek Home Position.
DAQ Control GSI, Aug 2005Hans G. Essel CBM - DAQ Control1 MBS monitor (FOPI) (J.Adamczewski, M.Stockmeier)
3.14 Work List IOC Core Channel Access. Changes to IOC Core Online add/delete of record instances Tool to support online add/delete OS independent layer.
Integrating EPICS and LabVIEW on Windows using DCOM Freddie Akeroyd ISIS Computing Group.
DEBUGGING EPICS APPLICATIONS Bob Dalesio and Rozelle Wright February 10, 1997.
Field Support Ideas. Tech-talk, 19 July 2007 Good Afternoon, I have now for the th time explained to some desperate EPICS newbie all the hoops one has.
Writing a Channel Access Client in EPICS Bob Dalesio, April 5, 2000.
Writing a Channel Access Client in EPICS Bob Dalesio, April 5, 2000.
Fast Fault Finder A Machine Protection Component.
EPICS Release 3.15 Bob Dalesio May 19, Features for 3.15 Support for large arrays - done for rsrv in 3.14 Channel access priorities - planned to.
Basic I/O in C Computer Organization I 1 August 2009 © McQuain, Feng & Ribbens Stream Model of I/O header file: A stream provides a connection.
1 1999/Ph 514: Flow of Control EPICS Flow of Control Marty Kraimer APS.
Control System Overview J. Frederick Bartlett Fermilab June 1,1999.
How to write a MSGQ Transport (MQT) Overview Nov 29, 2005 Todd Mullanix.
4P13 Week 12 Talking Points Device Drivers 1.Auto-configuration and initialization routines 2.Routines for servicing I/O requests (the top half)
Argonne National Laboratory is managed by The University of Chicago for the U.S. Department of Energy ICALEPCS 2005: EPICS Workshop EPICS V4 : Runtime.
May 30-31, 2012 HDF5 Workshop at PSI May Metadata Journaling Dana Robinson The HDF Group Efficient Use of HDF5 With High Data Rate X-Ray Detectors.
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 1999/Ph 514: Supported Hardware EPICS Supported Hardware Ned D. Arnold APS.
1 Channel Access Concepts – IHEP EPICS Training – K.F – Aug EPICS Channel Access Concepts Kazuro Furukawa, KEK (Bob Dalesio, LANL)
1 EPICS Flow of Control: EPICS Workshop at IHEP, Beijing, August 2001 EPICS Flow of Control Marty Kraimer APS.
Files A collection of related data treated as a unit. Two types Text
Control System Overview J. Frederick Bartlett Fermilab June 1,1999.
Writing Device Support Eric Norum November 16, 2004 Getting Started with EPICS Lecture Series.
Real Numbers Device driver process within the operating system that interacts with I/O controller logical record 1 logical record 2 logical record 3.
Event Sources and Realtime Actions
OPERATING SYSTEM CONCEPT AND PRACTISE
JavaIOC Overview and Update
Andrew Johnson and Eric Norum AES Controls Group, Argonne
BY GAWARE S.R. COMPUTER SCI. DEPARTMENT
C Basics.
CONFIGURING HARDWARE DEVICE & START UP PROCESS
11.1 Interrupt Mechanism, Type, and Priority
Classes and Objects.
Training Module Introduction to the TB9100/P25 CG/P25 TAG Customer Service Software (CSS) Describes Release 3.95 for Trunked TB9100 and P25 TAG Release.
Server-Side Plugins Andrew Johnson, Ralph Lange
Writing a Channel Access Client in EPICS
Channel Access Concepts
Intertask Communication
Programming Languages and Paradigms
EPICS APPLICATION DEVELOPMENT
Banafsheh Hajinasab Based on presentation by K. Strnisa, Cosylab
Channel Access Concepts
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

EPICS Record/Device/Driver Support Interfaces Jeff Hill 2/24/2019 rec dev drv

Outline EPICS Software Architecture Review record support interface device support interface driver support interface EPICS status codes EPICS IO address formats installation 2/24/2019 rec dev drv

EPICS Software Architecture CA Server DB Common Record Support IO Plant Device Support Driver Support Optional CA Client Client Tool 2/24/2019 rec dev drv

Record Support provides implementation for a record type plugs into “database common” environment must prepare a record definition file which defines the data structure - xxx.dbd must supply a C source file which provides the execution semantics many examples in $(EPICS)/base/src/rec 2/24/2019 rec dev drv

Record Description File - xxx.dbd recordtype(xxx) { include “dbCommon.dbd” field(PREC, DBF_DOUBLE) { prompt(“Display Precision”) promtGroup(GUI_DISPLAY) } . 2/24/2019 rec dev drv

Record Support Routines provide execution semantics initialize record instance record processing special record processing convert database address initialize record type get array info set array info get units get precision get string for field’s enumerated value set enumerated field’s value using string graphic/control/alarm limits 2/24/2019 rec dev drv

Initialize Record Support Type typedef long recInit_t (); record type specific initialization called once for each record type in the system 2/24/2019 rec dev drv

Initialize Record Instance typedef long recInitInstance_t (void *precord, int pass); two pass record instance initialization initializations private to this record performed when pass==0 initializations referring to other records performed when pass==1 2/24/2019 rec dev drv

Record Processing typedef long recProcess_t (void *precord); record personality implemented here see the application developers guide for the details 2/24/2019 rec dev drv

Before Record Processing decision to process a record check for record active (pact TRUE) verify that the record isn't disabled 2/24/2019 rec dev drv

Record Processing Routine set record active while it is being processed perform I/O (with aid of device support) check for record specific alarm conditions raise database monitors request processing of forward links 2/24/2019 rec dev drv

Asynchronous Record Processing block scan tasks for slow devices? not! initiate the I/O operation and set pact TRUE return immediately without completing record processing when I/O operation completes call record processing again set pact FALSE inside record processing 2/24/2019 rec dev drv

Special Record Processing long recSpecial_t (struct dbAddr *paddr, int after); the record description tags fields with these attributes the file “special.h” defines special field attributes special attribute >= 100 then this routine called before/after modifying the field 2/24/2019 rec dev drv

Convert Database Address typedef long recCvtDbaddr_t (struct dbAddr *paddr); supply this routine only if the field is not stored within the record data structure Example: fields that are arrays 2/24/2019 rec dev drv

Get Array Info typedef long recGetArrayInfo_t ( struct dbAddr *paddr, long *no_elements, long *offset); arrays are variable sized up to a maximum specified by “recCvtDbAddr()” this routine identifies the current length offset!=0 is only used for ring buffers 2/24/2019 rec dev drv

Put Array Info typedef long recPutArrayInfo_t( struct dbAddr *paddr, long nNew); called when the array length is modified by dbCommon Ex: client (or another record) writes array 2/24/2019 rec dev drv

Get Units typedef long recGetUnits_t ( struct dbAddr *paddr, char units[8]); 2/24/2019 rec dev drv

Get Precision typedef long recGetPrecision ( struct dbAddr *paddr, long *precision); suggested number of digits used to display the field’s analog value 2/24/2019 rec dev drv

Get String Corresponding to Field’s Enumerated Value typedef long recGetEnumStr_t ( struct dbAddr *paddr, char *pbuffer); special string conversion used to associated a string with a binary state 2/24/2019 rec dev drv

Get String Table for Field With Enumerated Value typedef long recGetEnumStrs_t ( struct dbAddr *paddr, struct dbr_enumStrs *p); used to obtain a table of strings for all states 2/24/2019 rec dev drv

Set Enumerated Value With String typedef long recPutEnumStr_t ( struct dbAddr *paddr, const char *pbuffer); sets the current state using a string 2/24/2019 rec dev drv

Graphic/Control/Alarm Limits typedef long recGetGraphicDouble_t ( struct dbAddr *paddr, struct dbr_grDouble *p); typedef long recGetControlDouble_t ( struct dbr_ctrlDouble *p); typedef long recGetAlarmDouble_t ( struct dbr_alDouble *p); called to obtain the analog limits 2/24/2019 rec dev drv

Record Support Entry Table struct rset aiRSET={ RSETNUMBER, report, initialize, initInstance, process, special, getValue,cvtDBAaddr, getArrayInfo, putArrayInfo, getUnits, getPrecision, getEnumStr, getEnumStrTbl, putEnumStr, getGraphicDouble, getControlDouble, getAlarmDouble}; set entry to NULL if default action OK 2/24/2019 rec dev drv

Device Support interface between device driver and record intimate knowledge of record(s) 2/24/2019 rec dev drv

Device Support Routines (Analog Input Record) initialization report initialize instance read ai device value linear convert attach to device interrupt 2/24/2019 rec dev drv

Device Support Header Files #include <aiRecord.h> #include <devSup.h> #include <dbScan.h> 2/24/2019 rec dev drv

AI Device Support Type Initialization long aiDevInit (unsigned pass) device type specific initialization common to all record types called, pass = 0, prior to initializing each record during "iocInit()" called, pass = 1, after initializing each record during "iocInit()" 2/24/2019 rec dev drv

AI Device Report long aiDevReport (struct aiRecord * pai, int level); common to all record types called once for every record instance when the user types "dbior <level>" device status to "stdout" from this routine detail increases with increasing "level" 2/24/2019 rec dev drv

AI Device Initialization for Record long aiDevInitInstance(struct aiRecord *pai) called from within “iocInit()” once for each rec inst attached to device pPriv = (struct XXXX *) calloc(1u, sizeof(struct XXXX); pai->dpvt = (void *) pPriv; the device address (pai->inp) is normally verified here 2/24/2019 rec dev drv

Device Interrupt Causes Record to be Processed device supports “scan on interrupt” higher scan rate scan synchronized with device device scans IO - change of state results in record processing 2/24/2019 rec dev drv

Each Interrupt Source prior to enabling and attaching to interrupt before returning from aiDevGetIoIntInfo() scanIoInit(&pXXXX->ioScanPvt); number of ”ioScanPvt“ allocated depends on the interrupt granularity of device one interrupt for all signals or one for each signal 2/24/2019 rec dev drv

Each Interrupt Occurrence scanIoRequest(pXXXX->ioScanPvt); safe to call scanIoRequest() from ISR don’t call scanIoRequest() until after database init (“iocInit()”) completes 2/24/2019 rec dev drv

AI Device Get IO Interrupt Info long aiDevGetIoIntInfo ( int cmd, struct aiRecord *pai, IOSCANPVT *ppvt); associates interrupt source with record *ppvt = pXXX->ioScanPvt; cmd==0 - insert into IO interrupt scan cmd==1 - remove from IO Interrupt scan 2/24/2019 rec dev drv

Read Analog Device Value long aiDevRead_(struct aiRecord * pai) { long rval; if (device OK) then rval=pDevMemoryMap-> aiRegister[pai->dpvt->signal]; pai->rval = rval; else recGblSetSevr(pai, READ_ALARM, INVALID_ALARM); endif } 2/24/2019 rec dev drv

AI Device Linear Convert long aiDevLinearConv ( struct aiRecord *pai, int after); Setup the slope (and any offset) for the conversion to engineering units if (!after) then return S_XXXX_OK; endif /* A 12 bit DAC is assumed here */ pai->eslo = (pai->eguf - pai->egul)/0xfff; pai->roff = ????; 2/24/2019 rec dev drv

From convert() in aiRecord.c double val; val = pai->rval + pai->roff; /* * adjust with slope/offset * if linear convert is used */ if(pai->aslo!=0.0) val*=aslo; if(pai->aoff!=0.0) val+=aoff; val = (val * pai->eslo) + pai->egul; 2/24/2019 rec dev drv

Asynchronous Devices read/write routine sets “PACT” true and returns zero for success. asynchronous IO completion call-back completes record processing don’t process a record from within an ISR 2/24/2019 rec dev drv

Example Asynchronous Read long devXxxRead (struct aiRecord *pai) { if (pai->pact) [ return S_devXxx_OK; /* zero */ } pai->pact = TRUE devXxxBeginAsyncIO(pai->dpvt); return S_devXxx_OK; 2/24/2019 rec dev drv

Example Asynchronous Read Completion void devXxxAsyncIOCompletion(struct aiRecord *pai, long ioStatus) { struct rset *prset = (struct rset *) pai->rset; dbScanLock(pai); if (ioStatus != S_devXxx_OK) { recGblSetSevr(pai, READ_ALARM, INVALID_ALARM); } (*prset->process)(pai); dbScanUnlock(pai); 2/24/2019 rec dev drv

Device Support Entry Table struct ai_dev_sup { long number; /* number of items in table */ aiDevReport_t *report; devInit_t *init; aiDevInitRec_t *initRec; aiDevGetIoIntInfo_t *getIoIntInfo; aiDevRead_t *read; aiDevLinearConv_t *specialLinearConv; }; LOCAL devInit_t devInitXXXX; LOCAL aiDevInitRec_t aiDevInitRecXXXX; LOCAL aiDevGetIoIntInfo_t aiDevGetIoIntInfoXXXX; LOCAL aiDevRead_t aiDevReadXXXX; LOCAL aiDevLinearConv_t aiDevLinearConvertXXXX; struct ai_dev_sup devAiXXXX = { 6L, /* external scope */ aiDevReportXXXX, aiDevInitXXXX, aiDevInitRecXXXX, aiDevGetIoIntInfoXXXX, aiDevReadXXXX, aiDevLinearConvertXXXX 2/24/2019 rec dev drv

Driver Support (Optional) communication hardware initializes prior to its being used by device support ex: VXI resource manager, MXI, GPIB, bit bus, AB DF1, CAMAC, CAN, bus repeaters when you want to limit a device driver's knowledge of EPICS 2/24/2019 rec dev drv

Driver Support Routines initialize report 2/24/2019 rec dev drv

Driver Initialize device driver specific initialization here long drvInitFunc(); device driver specific initialization here this routine is called once by iocInit() prior to database initialization 2/24/2019 rec dev drv

Driver Report called when the user types "dbior <level>" long drvReportFunc(int level); called when the user types "dbior <level>" provides device status to stdout increasing details with increasing "level" raw addresses, raw signal values, and device status used by persons maintaining the hardware 2/24/2019 rec dev drv

Driver Support Entry Table #include <drvSup.h> typedef long drvInitFunc_t (void); typedef long drvReportFunc_t (int level); LOCAL drvReportFunc_t drvXXXXReport; LOCAL drvInitFunc_t drvXXXXInit; struct drvSupEntryTable { long number; drvReportFunc_t *report; drvInitFunc_t *init; }drvXXXX = { 2L, /* the number of functions */ drvReportXXXX, drvInitXXXX }; 2/24/2019 rec dev drv

EPICS “Built-In” IO address Formats 2/24/2019 rec dev drv

IO Type Isn’t “Built-In” /* from $EPICS/base/include */ #include <link.h> use "INST_IO" addressing parse parameter string in device support 2/24/2019 rec dev drv

Record Support Installation add to db description “tnInclude.dbd” include “xxxrecord.dbd” 2/24/2019 rec dev drv

Device Support Installation add to the db description “xyzInclude.dbd” device (xxx, INST_IO, devXxxYyy, “yyy device”) xxx - record type INST_IO - IO addressing type devXxxYyy - device support entry table name “yyy device” - configuration menu label for DTYP field load object modules prior to "iocInit()" optionally install error codes 2/24/2019 rec dev drv

Driver Support Installation add to db description “tnInclude.dbd” driver (drvXxx) drvXxx - driver support entry table name load object modules prior to "iocInit()" optionally install your error codes 2/24/2019 rec dev drv

Record Instance record (ai, ”myRecordName") { field(DTYP, ”yyy device") field(SCAN, "I/O Intr") field(INP, "@yyy 3") field(LINR, "LINEAR") field(EGUF, ”0") field(EGUL,"-10") field(HOPR, "10") field(LOPR, "0") } 2/24/2019 rec dev drv

EPICS Status Codes (Optional) define a subsystem code and error constants in your subsystem's header file #define M_xxxx (520 <<16) /*VXI Driver*/ #define S_XXX_bad (M_xxxx| 1) /* a really bad failure*/ #define S_XXX_worse (M_xxxx| 2) /* even worse */ zero is always a success code #define S_XXX_OK 0 -1 is always a failure code 2/24/2019 rec dev drv

Install ERROR Codes (Optional) Define error codes in sub-systems header file Add your sub-system's header file to “ERR_S_FILES in config/CONFIG_SITE” ERR_S_FILES += <path>/drvXXX.h Type "gmake" in "$EPICS/base” 2/24/2019 rec dev drv

More Information many examples in $(EPICS)/base/src/rec many examples in $(EPICS)/base/src/dev many examples in $(EPICS)/base/src/drv “Application developers Guide” by Marty Kraimer (on the WEB) “Record Reference Manual” by Marty Kraimer (on the WEB) 2/24/2019 rec dev drv

EPICS Device Support Installation Hands On Jeff Hill 2/24/2019 rec dev drv

Outline Examine example device support Walk through installation steps specific to analog input record source code: xxxApp/src/devAiXxx.c Emphasis on the EPICS interfaces Instrument IO addressing (INST_IO) format: “xxx <signal number>” Walk through installation steps Verify normal and off-normal operation 2/24/2019 rec dev drv

Build System Installation Install source file into build system Modify xxxApp/src/Makefile.Vx SRCS.c += ../ devAiXxx.c create devAiXxx.o from devAiXxx.c LIBOBJS += devAiXxx.o add devAiXxx.o to xxxLib 2/24/2019 rec dev drv

Database Description Installation Modify xxxInclude.dbd data base description device (ai, INST_IO, devAiXxx, “device x”) uncomment record include in base.dbd as required (as required) #include “aiRecord.dbd” 2/24/2019 rec dev drv

Build the application in xxxApp/src type “gmake” verify source code rebuild verify data base description rebuild 2/24/2019 rec dev drv

Create Record Instance With Sophisticated Tool - Text Editor Create file xxxApp/Db/myRecInstance.db record (ai, ”myRecordName") { field(DTYP, ”device x") field(SCAN, "I/O Intr") field(INP, “@xxx 3") field(LINR, "LINEAR") field(EGUF, "10") field(EGUL,"-10") field(HOPR, "10") field(LOPR, "0") } 2/24/2019 rec dev drv

Modify the startup script Load the database before “iocInit” is called cd “xxxApp/Db/” dbLoadRecords (“myRecInstance.db”) Load the object code - devAiXxx.o before “iocInit” is called in application object library - xxxLib ld < xxxLib 2/24/2019 rec dev drv

Verify normal and off-normal operation reboot IOC watch for messages occurring during iocInit verify that the record is in UDF alarm dbpr “myRecordName”, nnn look at fields “STAT”and “SEVR” 2/24/2019 rec dev drv

Verify normal and off-normal operation cause a scan on interrupt event aiDevXxxUpdate (unsigned signalNo, boolean deviceOk, unsigned value) post new ai device value verify that the record isn't in alarm state look at STAT, SEVR. VAL fields place ai device in invalid state verify that the record is in alarm state look at STAT, SEVR fields 2/24/2019 rec dev drv