EPICS Application Developer's Guide
Total Page:16
File Type:pdf, Size:1020Kb
1 EPICS Application Developer’s Guide EPICS Base Release 3.15.0.2 17 October 2014 Andrew N. Johnson, Janet B. Anderson, Martin R. Kraimer (Argonne National Laboratory) W. Eric Norum (Lawrence Berkeley National Laboratory) Jeffrey O. Hill (Los Alamos National Laboratory) Ralph Lange, Benjamin Franksen (Helmholtz-Zentrum Berlin) Peter Denison (Diamond Light Source) 2 Contents EPICS Applications Developer’s Guide1 Table of Contents 7 1 Introduction 9 1.1 Overview.................................................9 1.2 Acknowledgments............................................ 11 2 Getting Started 13 2.1 Introduction................................................ 13 2.2 Example IOC Application........................................ 13 2.3 Channel Access Host Example...................................... 15 2.4 iocsh.................................................... 16 2.5 Building IOC components........................................ 16 2.6 makeBaseApp.pl............................................. 19 2.7 vxWorks boot parameters......................................... 22 2.8 RTEMS boot procedure.......................................... 23 3 EPICS Overview 25 3.1 What is EPICS?.............................................. 25 3.2 Basic Attributes.............................................. 26 3.3 IOC Software Components........................................ 26 3.4 Channel Access.............................................. 28 3.5 OPI Tools................................................. 30 3.6 EPICS Core Software........................................... 30 4 Build Facility 33 4.1 Overview................................................. 33 4.2 Build Requirements............................................ 35 4.3 Configuration Definitions......................................... 36 4.4 Makefiles................................................. 41 4.5 Make................................................... 42 4.6 Makefile definitions............................................ 43 4.7 Table of Makefile definitions....................................... 71 4.8 Configuration Files............................................ 78 4.9 Build Documentation Files........................................ 81 4.10 Startup Files................................................ 82 5 Database Locking, Scanning, And Processing 83 5.1 Overview................................................. 83 5.2 Record Links............................................... 83 5.3 Database Links.............................................. 84 5.4 Database Locking............................................. 85 3 4 CONTENTS 5.5 Database Scanning............................................ 85 5.6 Record Processing............................................ 86 5.7 Guidelines for Creating Database Links................................. 86 5.8 Guidelines for Synchronous Records................................... 89 5.9 Guidelines for Asynchronous Records.................................. 89 5.10 Cached Puts................................................ 91 5.11 processNotify............................................... 91 5.12 Channel Access Links........................................... 91 6 Database Definition 95 6.1 Overview................................................. 95 6.2 Summary of Database Syntax....................................... 95 6.3 General Rules for Database Definition.................................. 96 6.4 path addpath – Path Definition................................... 98 6.5 include – Include File......................................... 99 6.6 menu – Menu Declaration........................................ 99 6.7 recordtype – Record Type Declaration................................ 100 6.8 device – Device Support Declaration................................. 103 6.9 driver – Driver Declaration...................................... 104 6.10 registrar – Registrar Declaration.................................. 104 6.11 variable – Variable Declaration.................................... 105 6.12 function – Function Declaration................................... 106 6.13 breaktable – Breakpoint Table.................................... 106 6.14 record – Record Instance........................................ 107 6.15 Record Information Item......................................... 110 6.16 Record Attributes............................................. 111 6.17 Breakpoint Tables – Discussion...................................... 111 6.18 Menu and Record Type Include File Generation.............................. 112 6.19 dbdExpand.pl............................................... 116 6.20 dbLoadDatabase............................................. 116 6.21 dbLoadRecords.............................................. 117 6.22 dbLoadTemplate............................................. 117 7 IOC Initialization 121 7.1 Overview - Environments requiring a main program........................... 121 7.2 Overview - vxWorks........................................... 122 7.3 Overview - RTEMS............................................ 122 7.4 IOC Initialization............................................. 123 7.5 Pausing an IOC.............................................. 125 7.6 Changing iocCore fixed limits...................................... 126 7.7 initHooks................................................. 126 7.8 Environment Variables.......................................... 128 7.9 Initialize Logging............................................. 128 8 Access Security 129 8.1 Overview................................................. 129 8.2 Quick Start................................................ 129 8.3 User’s Guide............................................... 130 8.4 Design Summary............................................. 135 8.5 Access Security Application Programmer’s Interface.......................... 138 8.6 Database Access Security......................................... 143 8.7 Channel Access Security......................................... 145 8.8 Trapping Channel Access Writes..................................... 147 8.9 Access Control: Implementation Overview............................... 147 CONTENTS 5 8.10 Structures................................................. 149 9 IOC Test Facilities 151 9.1 Overview................................................. 151 9.2 Database List, Get, Put.......................................... 151 9.3 Breakpoints................................................ 154 9.4 Trace Processing............................................. 155 9.5 Error Logging............................................... 155 9.6 Hardware Reports............................................. 156 9.7 Scan Reports............................................... 157 9.8 General Time............................................... 157 9.9 Access Security Commands....................................... 158 9.10 Channel Access Reports......................................... 160 9.11 Interrupt Vectors............................................. 161 9.12 Miscellaneous............................................... 161 9.13 Database System Test Routines...................................... 162 9.14 Record Link Reports........................................... 163 9.15 Old Database Access Testing....................................... 163 9.16 Routines to dump database information................................. 164 10 IOC Error Logging 167 10.1 Overview................................................. 167 10.2 Error Message Routines.......................................... 168 10.3 errlog Listeners.............................................. 169 10.4 errlogThread............................................... 170 10.5 console output and message queue size.................................. 170 10.6 Status Codes................................................ 170 10.7 iocLog................................................... 171 11 Record Support 175 11.1 Overview................................................. 175 11.2 Overview of Record Processing..................................... 175 11.3 Record Support and Device Support Entry Tables............................ 176 11.4 Example Record Support Module.................................... 177 11.5 Record Support Routines......................................... 183 11.6 Global Record Support Routines..................................... 187 12 Device Support 191 12.1 Overview................................................. 191 12.2 Example Synchronous Device Support Module............................. 192 12.3 Example Asynchronous Device Support Module............................. 193 12.4 Device Support Routines......................................... 195 12.5 Extended Device Support......................................... 196 13 Driver Support 199 13.1 Overview................................................. 199 13.2 Device Drivers.............................................. 199 14 Static Database Access 203 14.1 Overview................................................. 203 14.2 Definitions................................................. 203 14.3 Allocating and Freeing DBBASE..................................... 205 14.4 DBENTRY Routines........................................... 205 14.5 Read and Write Database......................................... 206 14.6 Manipulating Record Types........................................ 207 6 CONTENTS 14.7 Manipulating Field Descriptions..................................... 208 14.8 Manipulating Record Attributes....................................