Merge lp:~jlmuir/epics-appdev/typo-fixes-3.14 into lp:~epics-documenters/epics-appdev/3.16

Proposed by J. Lewis Muir
Status: Merged
Merged at revision: 37
Proposed branch: lp:~jlmuir/epics-appdev/typo-fixes-3.14
Merge into: lp:~epics-documenters/epics-appdev/3.16
Diff against target: 1203 lines (+362/-324) (has conflicts)
3 files modified
tex/errorLogging.tex (+141/-133)
tex/libCom.tex (+1/-1)
tex/recordSupport.tex (+220/-190)
Text conflict in tex/errorLogging.tex
To merge this branch: bzr merge lp:~jlmuir/epics-appdev/typo-fixes-3.14
Reviewer Review Type Date Requested Status
Ralph Lange Needs Fixing
Review via email: mp+87812@code.launchpad.net

Description of the change

Typo fix.

To post a comment you must log in.
Revision history for this message
Ralph Lange (ralph-lange) wrote :

Could you fix the conflict and re-propose?

review: Needs Fixing
38. By Andrew Johnson

Merged Lewis' typo fix.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tex/errorLogging.tex'
--- tex/errorLogging.tex 2011-10-28 20:44:28 +0000
+++ tex/errorLogging.tex 2012-01-06 20:56:29 +0000
@@ -3,26 +3,25 @@
33
4\section{Overview }4\section{Overview }
55
6Errors detected by an IOC can be divided into classes: Errors related to a particular client and errors not attributable to a 6Errors detected by an IOC can be divided into classes:
7particular client. An example of the first type of error is an illegal Channel Access request. For this type of error, a status 7Errors related to a particular client and errors not attributable to a particular client.
8value should be passed back to the client. An example of the second type of error is a device driver detecting a hardware 8An example of the first type of error is an illegal Channel Access request.
9error. This type of error should be reported to a system wide error handler.9For this type of error, a status value should be passed back to the client.
10An example of the second type of error is a device driver detecting a hardware error.
11This type of error should be reported to a system wide error handler.
1012
11Dividing errors into these two classes is complicated by a number of factors.13Dividing errors into these two classes is complicated by a number of factors.
1214
13\begin{itemize}15\begin{itemize}
14\item In many cases it is not possible for the routine detecting an error to decide which type of error occurred. 16\item In many cases it is not possible for the routine detecting an error to decide which type of error occurred.
1517
16\item Normally, only the routine detecting the error knows how to generate a fully descriptive error message. Thus, if a 18\item Normally, only the routine detecting the error knows how to generate a fully descriptive error message.
17routine decides that the error belongs to a particular client and merely returns an error status value, the ability to 19Thus, if a routine decides that the error belongs to a particular client and merely returns an error status value, the ability to generate a fully descriptive error message is lost.
18generate a fully descriptive error message is lost. 20
1921\item If a routine always generates fully descriptive error messages then a particular client could cause error message storms.
20\item If a routine always generates fully descriptive error messages then a particular client could cause error message 22
21storms.23\item While developing a new application the programmer normally prefers fully descriptive error messages.
2224For a production system, however, the system wide error handler should not normally receive error messages cause by a particular client.
23\item While developing a new application the programmer normally prefers fully descriptive error messages. For a
24production system, however, the system wide error handler should not normally receive error messages cause by a
25particular client.
2625
27\end{itemize}26\end{itemize}
2827
@@ -37,18 +36,20 @@
3736
38\item errlogThread - A thread that passes the messages to all registered listeners.37\item errlogThread - A thread that passes the messages to all registered listeners.
3938
40\item console output and message buffer size - Messages can also be written to the console. The storage for the message 39\item console output and message buffer size - Messages can also be written to the console.
41queue can be specified by the user.40The storage for the message queue can be specified by the user.
4241
43\item status codes - EPICS status codes.42\item status codes - EPICS status codes.
4443
45\item iocLog- A system wide error logger supplied with base. It writes all messages to a system wide file.44\item iocLog- A system wide error logger supplied with base.
45It writes all messages to a system wide file.
4646
47NOTE: Many sites use CMLOG instead of iocLog.47NOTE: Many sites use CMLOG instead of iocLog.
4848
49\end{itemize}49\end{itemize}
5050
51NOTE: \verb|recGbl| error routines are also provided. They in turn call one of the error message routines.51NOTE: \verb|recGbl| error routines are also provided.
52They in turn call one of the error message routines.
5253
53\section{Error Message Routines}54\section{Error Message Routines}
5455
@@ -64,10 +65,8 @@
64\index{errlogVprintf}65\index{errlogVprintf}
65\index{errlogMessage}66\index{errlogMessage}
66\index{errlogFlush}67\index{errlogFlush}
67 \verb|errlogPrintf| and \verb|errlogVprintf| are like \verb|printf| and \verb|vprintf| provided by the standard C library, except 68\verb|errlogPrintf| and \verb|errlogVprintf| are like \verb|printf| and \verb|vprintf| provided by the standard C library, except that their output is sent to the errlog task; unless configured not to, the output will appear on the console as well.
68that their output is sent to the errlog task; unless configured not to, the output will appear on the console as well. Consult 69Consult any book that describes the standard C library such as ``The C Programming Language ANSI C Edition" by Kernighan and Ritchie.
69any book that describes the standard C library such as ``The C Programming Language ANSI C Edition" by Kernighan
70and Ritchie.
7170
72\verb|errlogMessage| sends message to the errlog task.71\verb|errlogMessage| sends message to the errlog task.
7372
@@ -101,14 +100,14 @@
101\index{errlogGetSevEnumString}100\index{errlogGetSevEnumString}
102\index{errlogSetSevToLog}101\index{errlogSetSevToLog}
103\index{errlogGetSevToLog}102\index{errlogGetSevToLog}
104\verb|errlogSevPrintf| and \verb|errlogSevVprintf| are like \verb|errlogPrintf| and \verb|errlogVprintf| except that they 103\verb|errlogSevPrintf| and \verb|errlogSevVprintf| are like \verb|errlogPrintf| and \verb|errlogVprintf| except that they add the severity to the beginning of the message in the form ``sevr=\textless{}value\textgreater{}" where value is one of ``info, minor, major, fatal".
105add the severity to the beginning of the message in the form ``sevr=\textless{}value\textgreater{}" where value is one of ``info, minor, major, 104Also the message is suppressed if severity is less than the current severity to suppress.
106fatal". Also the message is suppressed if severity is less than the current severity to suppress. If epicsThreadIsOkToBlock 105If \verb|epicsThreadIsOkToBlock| is true, which is true during iocInit, errlogSevVprintf does NOT send output to the errlog task.
107is true, which is true during iocInit, errlogSevVprintf does NOT send output to the errlog task.106
108107\verb|errlogGetSevEnumString| gets the string value of severity.
109\verb|errlogGetSevEnumString| gets the string value of severity. 108
110109\verb|errlogSetSevToLog| sets the severity to log.
111 \verb|errlogSetSevToLog| sets the severity to log. \verb|errlogGetSevToLog| gets the current severity to log.110\verb|errlogGetSevToLog| gets the current severity to log.
112111
113\subsection{Status Routines }112\subsection{Status Routines }
114113
@@ -131,25 +130,23 @@
131Where status is defined as:130Where status is defined as:
132131
133\begin{itemize}132\begin{itemize}
134\item 0: Find latest vxWorks or Unix error.133\item 0: Find latest vxWorks or Unix error.
135134
136\item -1: Don't report status.135\item -1: Don't report status.
137136
138\item Other: See ``Return Status Values" above.137\item Other: See ``Return Status Values" above.
139138
140\end{itemize}139\end{itemize}
141140
142\verb|errMessage|, via a call to \verb|errPrintf|, prints the message, the status symbol and string values, and the name of the task 141\verb|errMessage|, via a call to \verb|errPrintf|, prints the message, the status symbol and string values, and the name of the task which invoked \verb|errMessage|.
143which invoked \verb|errMessage|. It also prints the name of the source file and the line number from which the call was 142It also prints the name of the source file and the line number from which the call was issued.
144issued.143
145144The calling routine is expected to pass a descriptive message to this routine.
146The calling routine is expected to pass a descriptive message to this routine. Many subsystems provide routines built on 145Many subsystems provide routines built on top of \verb|errMessage| which generate descriptive messages.
147top of \verb|errMessage| which generate descriptive messages. 146
148147An IOC global variable \verb|errVerbose|, defined as an \verb|external| in \verb|errMdef.h|, specifies verbose messages.
149An IOC global variable \verb|errVerbose|, defined as an \verb|external| in \verb|errMdef.h|, specifies verbose messages. If 148If \verb|errVerbose| is \verb|TRUE| then \verb|errMessage| should be called whenever an error is detected even if it is known that the error belongs to a specific client.
150\verb|errVerbose| is \verb|TRUE| then \verb|errMessage| should be called whenever an error is detected even if it is known that the 149If \verb|errVerbose| is \verb|FALSE| then \verb|errMessage| should be called only for errors that are not caused by a specific client.
151error belongs to a specific client. If \verb|errVerbose| is \verb|FALSE| then \verb|errMessage| should be called only for errors that are
152not caused by a specific client.
153150
154Routine \verb|errPrintf| is normally called as follows:151Routine \verb|errPrintf| is normally called as follows:
155152
@@ -161,28 +158,28 @@
161Where status is defined as:158Where status is defined as:
162159
163\begin{itemize}160\begin{itemize}
164\item 0: Find latest vxWorks or Unix error.161\item 0: Find latest vxWorks or Unix error.
165162
166\item -1: Don't report status.163\item -1: Don't report status.
167164
168\item Other: See ``Return Status Values", above.165\item Other: See ``Return Status Values", above.
169166
170\end{itemize}167\end{itemize}
171168
172FILE and LINE are defined as:169FILE and LINE are defined as:
173170
174\begin{itemize}171\begin{itemize}
175\item \_\_FILE\_\_ As shown or \verb|NULL| if the file name and line number should not be printed.172\item \_\_FILE\_\_ As shown or \verb|NULL| if the file name and line number should not be printed.
176173
177\item \_\_LINE\_\_ As shown174\item \_\_LINE\_\_ As shown
178175
179\end{itemize}176\end{itemize}
180177
181The remaining arguments are just like the arguments to the C \verb|printf| routine. \verb|errVerbose| determines if the filename 178The remaining arguments are just like the arguments to the C \verb|printf| routine.
182and line number are shown.179\verb|errVerbose| determines if the filename and line number are shown.
183180
184An EPICS status code can also be converted to a string. If the supplied status code isn't registered in the status code 181An EPICS status code can also be converted to a string.
185database then the raw status code number is converted into a string in the destination buffer.182If the supplied status code isn't registered in the status code database then the raw status code number is converted into a string in the destination buffer.
186183
187\begin{verbatim}184\begin{verbatim}
188#include "errMdef.h"185#include "errMdef.h"
@@ -198,12 +195,14 @@
198195
199\index{epicsPrintf}196\index{epicsPrintf}
200\index{epicsVprintf}197\index{epicsVprintf}
201These are macros that call errlogPrintf and errlogVprintf. They are provided for compatibility.198These are macros that call errlogPrintf and errlogVprintf.
199They are provided for compatibility.
202200
203\section{errlog Listeners}201\section{errlog Listeners}
204202
205\index{errlog Listeners}203\index{errlog Listeners}
206Any code can receive errlog message. The following are the calls to add and remove a listener.204Any code can receive errlog message.
205The following are the calls to add and remove a listener.
207206
208\begin{verbatim}207\begin{verbatim}
209typedef void(*errlogListener) (void *pvt,const char *message);208typedef void(*errlogListener) (void *pvt,const char *message);
@@ -214,34 +213,39 @@
214\index{errlogListener}213\index{errlogListener}
215\index{errlogAddListener}214\index{errlogAddListener}
216\index{errlogRemoveListener}215\index{errlogRemoveListener}
217These routines add/remove a callback that receives each error message. These routines are the interface to the actual 216These routines add/remove a callback that receives each error message.
218system wide error handlers.217These routines are the interface to the actual system wide error handlers.
219218
220\section{errlogThread}219\section{errlogThread}
221220
222\index{errlogThread}221\index{errlogThread}
223The error message routines can be called by any non-interrupt level code. These routines pass the message to the errlog 222The error message routines can be called by any non-interrupt level code.
224Thread. If any of the error message routines are called at interrupt level, \verb|epicsInterruptContextMessage| is 223These routines pass the message to the errlog Thread.
225called with the message ``errlogPrintf called from interrupt level".224If any of the error message routines are called at interrupt level, \verb|epicsInterruptContextMessage| is called with the message ``errlogPrintf called from interrupt level".
226225
227errlogThread manages the messages. Messages are placed in a message queue, which is read by errlogThread. The 226\verb|errlogThread| manages the messages.
228message queue uses a fixed block of memory to hold all messages. When the message queue is full additional messages 227Messages are placed in a message queue, which is read by errlogThread.
229are rejected but a count of missed messages is kept. The next time the message queue empties an extra message about the 228The message queue uses a fixed block of memory to hold all messages.
230missed messages is generated.229When the message queue is full additional messages are rejected but a count of missed messages is kept.
231230The next time the message queue empties an extra message about the missed messages is generated.
232The maximum message size is by default 256 characters. If a message is longer, the message is truncated and a message 231
233explaining that it was truncated is appended. There is a chance that long messages corrupt memory. This only happens if 232The maximum message size is by default 256 characters.
234client code is defective. Long messages most likely result from ``\%s" formats with a bad string argument.233If a message is longer, the message is truncated and a message explaining that it was truncated is appended.
234There is a chance that long messages corrupt memory.
235This only happens if client code is defective.
236Long messages most likely result from ``\%s" formats with a bad string argument.
235237
236errlogThread passes each message to any registered listener.238errlogThread passes each message to any registered listener.
237239
238\section{console output and message queue size}240\section{console output and message queue size}
239241
240The errlog system can also display messages on the ioc console. It calls \verb|epicsThreadIsOkToBlock| to decide when 242The errlog system can also display messages on the ioc console.
241to display the message. If it is OK to block, the message is displayed by the same thread that calls one of the errlog print 243It calls \verb|epicsThreadIsOkToBlock| to decide when to display the message.
242routines. If it is not OK to block, errlorThread displays the messages.244If it is OK to block, the message is displayed by the same thread that calls one of the errlog print routines.
245If it is not OK to block, errlogThread displays the messages.
243246
244Normally the errlog system displays all messages on the console. \verb|eltc| can be used to suppress these messages.247Normally the errlog system displays all messages on the console.
248\verb|eltc| can be used to suppress these messages.
245249
246\begin{verbatim}250\begin{verbatim}
247int eltc(int yesno); /* error log to console (0 or 1) */251int eltc(int yesno); /* error log to console (0 or 1) */
@@ -252,11 +256,11 @@
252\index{eltc}256\index{eltc}
253\index{errlogInit}257\index{errlogInit}
254\index{errlogInit2}258\index{errlogInit2}
255eltc determines if errlog task writes message to the console. During error messages storms this command can be used to 259eltc determines if errlog task writes message to the console.
256suppress console messages. A argument of 0 suppresses the messages and any other value lets the message go to the 260During error message storms this command can be used to suppress console messages.
257console. 261A argument of 0 suppresses the messages, any other value lets messages go to the console.
258262
259errlogInit or errlogInit2 can be used to initialize the error logging system with a larger buffer and maximum message size. 263\verb|errlogInit| or \verb|errlogInit2| can be used to initialize the error logging system with a larger buffer and maximum message size.
260The default buffer size is 1280 bytes, and the default maximum message size is 256.264The default buffer size is 1280 bytes, and the default maximum message size is 256.
261265
262\section{Status Codes}266\section{Status Codes}
@@ -265,34 +269,34 @@
265EPICS defined status values provide the following features:269EPICS defined status values provide the following features:
266270
267\begin{itemize}271\begin{itemize}
268\item Whenever possible, IOC routines return a status value: (0, non-0) means (\verb|OK|, \verb|ERROR|).272\item Whenever possible, IOC routines return a status value:
2730 means OK, non-0 means an error.
269274
270\item The include files for each IOC subsystem contain macros defining error status symbols and strings.275\item The header files for most IOC subsystems contain macros defining error status symbols and strings.
271276
272\item Routines are provided for run time access of the error status symbols and strings.277\item Routines are provided for run time access of the error status symbols and strings.
273278
279\index{errVerbose}
274\item A global variable \verb|errVerbose| helps code decide if error messages should be generated.280\item A global variable \verb|errVerbose| helps code decide if error messages should be generated.
275281
276\end{itemize}282\end{itemize}
277283
278WARNING: During the fall of 1995 a series of tech-talk messages were generated concerning EPICS status values. No 284IOC routines often return a long integer status value, encoded similar to the vxWorks error status encoding.
279consensus was reached.285On some modern architectures a long integer is more than 32 bits wide, but in order to keep the API compatible the status values are still passed as long integers, even though only 32 bits are ever used.
280286The most significant 16 bits indicate the subsystem or module where the error occurred.
281Whenever it makes sense, IOC routines return a status value encoded similar to the vxWorks error status encoding. The 287The least significant 16 bits contain a subsystem-specific status value.
282most significant short word indicates the subsystem module within which the error occurred. The low order short word is 288In order that status values do not conflict with the vxWorks error status values, all subsystem numbers are greater than 500.
283a subsystem status value. In order that status values do not conflict with the vxWorks error status values all subsystem 289
284numbers are greater than 500. 290\index{errMdef.h}
285291A header file \verb|errMdef.h| defines macros for all the subsystem numbers.
286A file \verb|epics/share/epicsH/errMdef.h| defines each subsystem number. For example the \verb|define| for the 292For example the database access routines use this module number:
287database access routines is:
288293
289\begin{verbatim}294\begin{verbatim}
290#define M_dbAccess (501 << 16) \295#define M_dbAccess (501 << 16) /*Database Access Routines*/
291/*Database Access Routines*/
292\end{verbatim}296\end{verbatim}
293297
294Directory ``\verb|epics/share/epicsH|" contains an \verb|include| library for every IOC subsystem that returns standard status 298There are header files for every IOC subsystem that returns standard status values.
295values. The status values are encoded with lines of the following format: 299The status values are encoded with lines of the following format:
296300
297\begin{verbatim}301\begin{verbatim}
298#define S_xxxxxxx value /*string value*/302#define S_xxxxxxx value /*string value*/
@@ -301,8 +305,7 @@
301For example:305For example:
302306
303\begin{verbatim}307\begin{verbatim}
304#define S_dbAccessBadDBR (M_dbAccess|3) \308#define S_dbAccessBadDBR (M_dbAccess|3) /*Invalid Database Request*/
305/*Invalid Database Request*/
306\end{verbatim}309\end{verbatim}
307310
308For example, when \verb|dbGetField| detects a bad database request type, it executes the statement:311For example, when \verb|dbGetField| detects a bad database request type, it executes the statement:
@@ -314,53 +317,58 @@
314The calling routine checks the return status as follows:317The calling routine checks the return status as follows:
315318
316\begin{verbatim}319\begin{verbatim}
317status = dbGetField( ...);320status = dbGetField(...);
318if(status) {/* Call was not successful */ }321if(status) {/* Call was not successful */ }
319\end{verbatim}322\end{verbatim}
320323
321\section{iocLog}324\section{iocLog}
322325
323\index{iocLog}326\index{iocLog}
324NOTE: Many sites use CMLOG instead of iocLog. See the CMLOG documentation for details.327NOTE: Many sites use CMLOG instead of iocLog.
328See the CMLOG documentation for details.
325329
326This consists of two modules: iocLogServer and iocLogClient. The client code runs on each ioc and listens for the 330This consists of two modules:
327messages generated locally by the errlog system. It also reports the messages from the vxWorks logMsg facility.331iocLogServer and iocLogClient.
332The client code runs on each ioc and listens for the messages generated locally by the errlog system.
333It also reports the messages from the vxWorks logMsg facility.
328334
329\subsection{iocLogServer}335\subsection{iocLogServer}
330336
331\index{iocLogServer}337\index{iocLogServer}
338<<<<<<< TREE
332This runs on a host. It receives messages for all enabled iocLogClients in the local area network. The messages are written 339This runs on a host. It receives messages for all enabled iocLogClients in the local area network. The messages are written
333to a file. Epics base provides a startup file ``base/src/libCom/log/rc2.logServer", which is a SystemV init script to start the server. 340to a file. Epics base provides a startup file ``base/src/libCom/log/rc2.logServer", which is a SystemV init script to start the server.
341=======
342This runs on a host.
343It receives messages for all enabled iocLogClients in the local area network.
344The messages are written to a file.
345Epics base provides a startup file ``base/src/util/rc2.logServer", which is a SystemV init script to start the server.
346>>>>>>> MERGE-SOURCE
334Consult this script for details.347Consult this script for details.
335348
336To start a log server on a UNIX or PC workstation you must first set the following environment variables and then run the 349To start a log server on a UNIX or PC workstation you must first set the following environment variables and then run the executable ``iocLogServer" on your PC or UNIX workstation.
337executable ``iocLogServer" on your PC or UNIX workstation.
338350
339\begin{description}351\begin{description}
340352
341\item \index{EPICS\_IOC\_LOG\_FILE\_NAME}EPICS\_IOC\_LOG\_FILE\_NAME 353\item \index{EPICS\_IOC\_LOG\_FILE\_NAME}EPICS\_IOC\_LOG\_FILE\_NAME
342354
343The name and path to the log file.355The name and path to the log file.
344356
345\item \index{EPICS\_IOC\_LOG\_FILE\_LIMIT}EPICS\_IOC\_LOG\_FILE\_LIMIT357\item \index{EPICS\_IOC\_LOG\_FILE\_LIMIT}EPICS\_IOC\_LOG\_FILE\_LIMIT
346358
347The maximum size in characters for the log file (after which it becomes a circular file and writes new 359The maximum size in characters for the log file (after which it becomes a circular file and writes new messages over old messages at the beginning of the file).
348messages over old messages at the beginning of the file). If the value is zero then there is no limit on the 360If the value is zero then there is no limit on the size of the log file.
349size of the log file.
350361
351\item \index{EPICS\_IOC\_LOG\_FILE\_COMMAND}EPICS\_IOC\_LOG\_FILE\_COMMAND362\item \index{EPICS\_IOC\_LOG\_FILE\_COMMAND}EPICS\_IOC\_LOG\_FILE\_COMMAND
352363
353A shell command string used to obtain the log file path name during initialization and in response to 364A shell command string used to obtain the log file path name during initialization and in response to SIGHUP.
354SIGHUP. The new path name will replace any path name supplied in EPICS\_IOC\_LOG\_FILE\_NAME.365The new path name will replace any path name supplied in EPICS\_IOC\_LOG\_FILE\_NAME.
355366
356Thus, if EPICS\_IOC\_LOG\_FILE\_NAME is 367Thus, if EPICS\_IOC\_LOG\_FILE\_NAME is ``a/b/c.log" and EPICS\_IOC\_LOG\_FILE\_COMMAND returns ``A/B" or ``A/B/" the log server will be stored at ``A/B/c.log"
357368
358"a/b/c.log" and EPICS\_IOC\_LOG\_FILE\_COMMAND returns ``A/B" or ``A/B/" the log server will be stored 369If EPICS\_IOC\_LOG\_FILE\_COMMAND is empty then this behavior is disabled.
359at ``A/B/c.log"370This feature is used at some sites for switching the server to a new directory at a fixed time each day.
360371This variable is currently used only by the UNIX version of the log server.
361If EPICS\_IOC\_LOG\_FILE\_COMMAND is empty then this behavior is disabled. This feature is used at
362some sites for switching the server to a new directory at a fixed time each day. This variable is currently
363used only by the UNIX version of the log server.
364372
365\item \index{EPICS\_IOC\_LOG\_PORT}EPICS\_IOC\_LOG\_PORT373\item \index{EPICS\_IOC\_LOG\_PORT}EPICS\_IOC\_LOG\_PORT
366374
@@ -368,37 +376,37 @@
368376
369\end{description}377\end{description}
370378
371To configure an IOC so that its messages are placed in the log you must set the environment variable 379To configure an IOC so that its messages are placed in the log you must set the environment variable EPICS\_IOC\_LOG\_INET to the IP address of the host that is running the log server, and EPICS\_IOC\_LOG\_PORT to the TCP/IP port used by the log server.
372EPICS\_IOC\_LOG\_INET to the IP address of the host that is running the log server, and EPICS\_IOC\_LOG\_PORT to the
373TCP/IP port used by the log server.
374380
375Defaults for all of the above parameters are specified in the files \$(EPICS\_BASE)/config/CONFIG\_SITE\_ENV and 381Defaults for all of the above parameters are specified in the files \$(EPICS\_BASE)/config/CONFIG\_SITE\_ENV and \$(EPICS\_BASE)/config/CONFIG\_ENV.
376\$(EPICS\_BASE)/config/CONFIG\_ENV.
377382
378\subsection{iocLogClient}383\subsection{iocLogClient}
379\label{iocLogClient}384\label{iocLogClient}
380385
381\index{iocLogClient}386\index{iocLogClient}
382This runs on each ioc. It is started by calling:387This runs on each ioc.
388It is started by calling:
383389
384\begin{verbatim}390\begin{verbatim}
385iocLogInit();391iocLogInit();
386\end{verbatim}392\end{verbatim}
387393
388The global variable \verb|iocLogDisable| can be used to enable/disable the messages from being sent to the server. Setting 394The global variable \verb|iocLogDisable| can be used to enable/disable the messages from being sent to the server.
389this variable to (0,1) (enables,disables) the messages generation. If \verb|iocLogDisable| is set to 1 before calling 395Setting this variable to (0,1) (enables, disables) the messages generation.
390\verb|iocLogInit| then \verb|iocLogClient| will not even initialize itself. \verb|iocLogDisable| can also be changed to turn 396If \verb|iocLogDisable| is set to 1 before calling \verb|iocLogInit| then \verb|iocLogClient| will not even initialize itself.
391logging on or off.397\verb|iocLogDisable| can also be changed to turn logging on or off.
392398
393\verb|iocLogClient| calls \verb|errlogAddListener| and sends each message to the \verb|iocLogServer|.399\verb|iocLogClient| calls \verb|errlogAddListener| and sends each message to the \verb|iocLogServer|.
394400
395\subsection{Configuring a Private Log Server}401\subsection{Configuring a Private Log Server}
396402
397In a testing environment it is desirable to use a private log server. This can be done as follows:403In a testing environment it is desirable to use a private log server.
404This can be done as follows:
398405
399\begin{itemize}406\begin{itemize}
400407
401\item Add a epicsEnvSet command to your IOC startup file. For example408\item Add a epicsEnvSet command to your IOC startup file.
409For example
402410
403\begin{verbatim}411\begin{verbatim}
404ld < iocCore412ld < iocCore
405413
=== modified file 'tex/libCom.tex'
--- tex/libCom.tex 2010-11-15 18:16:16 +0000
+++ tex/libCom.tex 2012-01-06 20:56:29 +0000
@@ -1561,7 +1561,7 @@
1561program's main() routine.1561program's main() routine.
15621562
1563On vxWorks and RTEMS, an alternative test harness can be used to run a series of tests in order and summarize the results 1563On vxWorks and RTEMS, an alternative test harness can be used to run a series of tests in order and summarize the results
1564from them all at the end just like the Perl harness does. The routine testHarness() is called once a the beginning of the test 1564from them all at the end just like the Perl harness does. The routine testHarness() is called once at the beginning of the test
1565harness program. Each test program is run by passing its main routine name to the runTest() macro which expands into a 1565harness program. Each test program is run by passing its main routine name to the runTest() macro which expands into a
1566call to the runTestFunc() routine. The last test program or the harness program itself must finish by calling epicsExit() 1566call to the runTestFunc() routine. The last test program or the harness program itself must finish by calling epicsExit()
1567which triggers the test summary mechanism to generate its result outputs (from an epicsAtExit callback routine).1567which triggers the test summary mechanism to generate its result outputs (from an epicsAtExit callback routine).
15681568
=== modified file 'tex/recordSupport.tex'
--- tex/recordSupport.tex 2010-11-15 18:16:16 +0000
+++ tex/recordSupport.tex 2012-01-06 20:56:29 +0000
@@ -3,35 +3,37 @@
33
4\section{Overview}4\section{Overview}
55
6The purpose of this chapter is to describe record support in sufficient detail such that a C programmer can write new 6The purpose of this chapter is to describe record support in sufficient detail such that a C programmer can write new record support modules.
7record support modules. Before attempting to write new support modules, you should carefully study a few of the existing 7Before attempting to write new support modules, you should carefully study a few of the existing support modules.
8support modules. If an existing support module is similar to the desired module most of the work will already be done.8If an existing support module is similar to the desired module most of the work will already be done.
99
10From previous chapters, it should be clear that many things happen as a result of record processing. The details of what 10From previous chapters, it should be clear that many things happen as a result of record processing.
11happens are dependent on the record type. In order to allow new record types and new device types without impacting the 11The details of what happens are dependent on the record type.
12core IOC system, the concept of record support and device support has been created. For each record type, a record 12In order to allow new record types and new device types without impacting the core IOC system, the concept of record support and device support is used.
13support module exists. It is responsible for all record specific details. In order to allow a record support module to be 13For each record type, a record support module exists.
14independent of device specific details, the concept of device support has been created.14It is responsible for all record specific details.
1515In order to allow a record support module to be independent of device specific details, the concept of device support has been created.
16A record support module consists of a standard set of routines which are called by database access routines. These 16
17routines implement record specific code. Each record type can define a standard set of device support routines specific to 17A record support module consists of a standard set of routines which are called by database access routines.
18that record type.18These routines implement record specific code.
1919Each record type can define a standard set of device support routines specific to that record type.
20By far the most important record support routine is \verb|process|, which \verb|dbProcess| calls when it wants to process a record. 20
21This routine is responsible for the details of record processing. In many cases it calls a device support I/O routine. The 21By far the most important record support routine is \verb|process|, which \verb|dbProcess| calls when it wants to process a record.
22next section gives an overview of what must be done in order to process a record. Next is a description of the entry tables 22This routine is responsible for the details of record processing.
23that must be provided by record and device support modules. The remaining sections give example record and device 23In many cases it calls a device support I/O routine.
24support modules and describe some global routines useful to record support modules.24The next section gives an overview of what must be done in order to process a record.
2525Next is a description of the entry tables that must be provided by record and device support modules.
26The record and device support modules are the only modules that are allowed to include the record specific include files 26The remaining sections give example record and device support modules and describe some global routines useful to record support modules.
27as defined in \verb|base/rec|. Thus they are the only routines that access record specific fields without going through database 27
28access.28The record and its device support modules are the only source files that should include the record specific header files.
29Thus they will be the only routines that access record specific fields without going through database access.
2930
30\section{Overview of Record Processing}31\section{Overview of Record Processing}
3132
32\index{Overview of Record Processing}33\index{Overview of Record Processing}
33The most important record support routine is \verb|process|. This routine determines what record processing means. Before 34The most important record support routine is \verb|process|.
34the record specific ``\verb|process|" routine is called, the following has already been done:35This routine determines what record processing means.
36Before the record specific ``\verb|process|" routine is called, the following has already been done:
3537
36\begin{itemize}38\begin{itemize}
37\item Decision to process a record.39\item Decision to process a record.
@@ -57,11 +59,12 @@
5759
58\end{itemize}60\end{itemize}
5961
60A complication of record processing is that some devices are intrinsically asynchronous. It is NEVER permissible to wait 62A complication of record processing is that some devices are intrinsically asynchronous.
61for a slow device to complete. Asynchronous records perform the following steps:63It is NEVER permissible to wait for a slow device to complete.
64Asynchronous records perform the following steps:
6265
63\begin{enumerate}66\begin{enumerate}
64\item Initiate the I/O operation and set \verb|pact| \verb|TRUE|67\item Initiate the I/O operation and set \verb|pact = TRUE|
6568
66\item Determine a method for again calling process when the operation completes69\item Determine a method for again calling process when the operation completes
6770
@@ -69,7 +72,7 @@
6972
70\item When process is called after the I/O operation complete record processing73\item When process is called after the I/O operation complete record processing
7174
72\item Set \verb|pact| \verb|FALSE| and return75\item Set \verb|pact = FALSE| and return
7376
74\end{enumerate}77\end{enumerate}
7578
@@ -77,35 +80,36 @@
7780
78\section{Record Support and Device Support Entry Tables}81\section{Record Support and Device Support Entry Tables}
7982
80Each record type has an associated set of record support routines. These routines are located via the data structures 83Each record type has an associated set of record support routines.
81defined in \verb|epics/share/epicsH/recSup.h|. The concept of record support routines isolates the \verb|iocCore| software 84These routines are located via the \verb|struct rset| data structure declared in \verb|recSup.h| and defined by the specific record type.
82from the details of each record type. Thus new records can be defined and supported without affecting the IOC core 85This use of a record support vector table isolates the \verb|iocCore| software from the implementation details of each record type.
83software.86Thus new record types can be defined without having to modify the IOC core software.
8487
85Each record type also has zero or more sets of device support routines. Record types without associated hardware, e.g. 88Each record type also has zero or more sets of device support routines.
86calculation records, normally do not have any associated device support. Record types with associated hardware normally 89Record types without associated hardware, e.g. calculation records, normally do not have any associated device support.
87have a device support module for each device type. The concept of device support isolates IOC core software and even 90Record types with associated hardware normally have a device support module for each device type.
88record support from device specific details.91The concept of device support isolates IOC core software and even record support from device specific details.
8992
90Corresponding to each record type is a set of record support routines. The set of routines is the same for every record type. 93Corresponding to each record type is a set of record support routines.
91These routines are located via a Record Support Entry Table (\index{RSET}\index{Record Support Entry Table}RSET), which has the following structure94The set of routines is the same for every record type.
95These routines are located via a Record Support Entry Table (\index{RSET}\index{Record Support Entry Table}RSET), which has the following structure:
9296
93\begin{verbatim}97\begin{verbatim}
94rset { /* record support entry table */98struct rset { /* record support entry table */
95 long number; /* number of support routine */99 long number; /* number of support routine */
96 RECSUPFUN report; /* print report */100 RECSUPFUN report; /* print report */
97 RECSUPFUN init; /* init support */101 RECSUPFUN init; /* init support */
98 RECSUPFUN init_record; /* init record */102 RECSUPFUN init_record; /* init record */
99 RECSUPFUN process; /* process record */103 RECSUPFUN process; /* process record */
100 RECSUPFUN special; /* special processing */104 RECSUPFUN special; /* special processing */
101 RECSUPFUN get_value; /* OBSOLETE: Just leave NULL */105 RECSUPFUN get_value; /* OBSOLETE: Just leave NULL */
102 RECSUPFUN cvt_dbaddr; /* cvt dbAddr */106 RECSUPFUN cvt_dbaddr; /* cvt dbAddr */
103 RECSUPFUN get_array_info;107 RECSUPFUN get_array_info;
104 RECSUPFUN put_array_info;108 RECSUPFUN put_array_info;
105 RECSUPFUN get_units;109 RECSUPFUN get_units;
106 RECSUPFUN get_precision;110 RECSUPFUN get_precision;
107 RECSUPFUN get_enum_str; /* get string from enum */111 RECSUPFUN get_enum_str; /* get string from enum */
108 RECSUPFUN get_enum_strs; /* get all enum strings */112 RECSUPFUN get_enum_strs; /* get all enum strings */
109 RECSUPFUN put_enum_str; /* put enum from string */113 RECSUPFUN put_enum_str; /* put enum from string */
110 RECSUPFUN get_graphic_double;114 RECSUPFUN get_graphic_double;
111 RECSUPFUN get_control_double;115 RECSUPFUN get_control_double;
@@ -119,35 +123,36 @@
119<record_type>RSET123<record_type>RSET
120\end{verbatim}124\end{verbatim}
121125
122Any routines not needed for the particular record type should be initialized to the value \verb|NULL|. Look at the example below 126Any routines not needed for the particular record type should be initialized to the value \verb|NULL|.
123for details.127Look at the example below for details.
124128
125Device support routines are located via a Device Support Entry Table (\index{DSET}\index{Device Support Entry Table}DSET), which has the following structure:129Device support routines are located via a Device Support Entry Table (\index{DSET}\index{Device Support Entry Table}DSET), which has the following structure:
126130
127\begin{verbatim}131\begin{verbatim}
128struct dset { /* device support entry table */132struct dset { /* device support entry table */
129 long number; /* number of support routines */133 long number; /* number of support routines */
130 DEVSUPFUN report; /* print report */134 DEVSUPFUN report; /* print report */
131 DEVSUPFUN init; /* init support */135 DEVSUPFUN init; /* init support */
132 DEVSUPFUN init_record;/* init record instance*/136 DEVSUPFUN init_record;/* init record instance*/
133 DEVSUPFUN get_ioint_info; /* get io interrupt info*/137 DEVSUPFUN get_ioint_info; /* get io interrupt info*/
134 /* other functions are record dependent*/138 /* other functions are record dependent*/
135};139};
136\end{verbatim}140\end{verbatim}
137141
138Each device support module must define its associated DSET. The external name must be the same as the name which 142Each device support module must define its associated DSET.
139appears in \verb|devSup.ascii|.143The external name must be the same as the name which appears in \verb|devSup.ascii|.
140144
141Any record support module which has associated device support must also include definitions for accessing its associated 145Any record support module which has associated device support must also include definitions for accessing its associated device support modules.
142device support modules. The field"\verb|dset|", which is located in \verb|dbCommon|, contains the address of the DSET. It is given a 146The field \verb|dset|, which is declared in \verb|dbCommon|, contains the address of the DSET.
143value by \verb|iocInit|.147It is given a value by \verb|iocInit|.
144148
145\section{Example Record Support Module}149\section{Example Record Support Module}
146150
147This section contains the skeleton of a record support package. The record type is \verb|xxx| and the record has the following 151This section contains the skeleton of a record support package.
148fields in addition to the \verb|dbCommon| fields: \verb|VAL|, \verb|PREC|, \verb|EGU|, \verb|HOPR|, \verb|LOPR|, \verb|HIHI|, \verb|LOLO|, \verb|HIGH|, \verb|LOW|, \verb|HHSV|, \verb|LLSV|, \verb|HSV|, 152The record type is \verb|xxx| and the record has the following fields in addition to the \verb|dbCommon| fields:
149\verb|LSV|, \verb|HYST|, \verb|ADEL|, \verb|MDEL|, \verb|LALM|, \verb|ALST|, \verb|MLST|. These fields will have the same meaning as they have for the \verb|ai| record. 153\verb|VAL|, \verb|PREC|, \verb|EGU|, \verb|HOPR|, \verb|LOPR|, \verb|HIHI|, \verb|LOLO|, \verb|HIGH|, \verb|LOW|, \verb|HHSV|, \verb|LLSV|, \verb|HSV|, \verb|LSV|, \verb|HYST|, \verb|ADEL|, \verb|MDEL|, \verb|LALM|, \verb|ALST|, \verb|MLST|.
150Consult the Record Reference manual for a description. 154These fields will have the same meaning as they have for the \verb|ai| record.
155Consult the Record Reference manual for a description.
151156
152\subsection{Declarations}157\subsection{Declarations}
153158
@@ -208,14 +213,12 @@
208static void monitor(xxxRecord *pxxx);213static void monitor(xxxRecord *pxxx);
209\end{verbatim}214\end{verbatim}
210215
211\index{RSET - example}The above declarations define the Record Support Entry Table (RSET), a template for the associated Device Support 216\index{RSET - example}The above declarations define the Record Support Entry Table (RSET), a template for the associated Device Support Entry Table (DSET), and forward declarations to private routines.
212Entry Table (DSET), and forward declarations to private routines.217
213218The RSET must be declared with an external name of \verb|xxxRSET|. It defines the record support routines supplied for this record type.
214The RSET must be declared with an external name of \verb|xxxRSET|. It defines the record support routines supplied for this 219Note that forward declarations are given for all routines supported and a \verb|NULL| declaration for any routine not supported.
215record type. Note that forward declarations are given for all routines supported and a \verb|NULL| declaration for any routine not 220
216supported.221The template for the DSET is declared for use by this module.
217
218The template for the DSET is declared for use by this module.
219222
220\subsection{init\_record}223\subsection{init\_record}
221224
@@ -246,16 +249,16 @@
246}249}
247\end{verbatim}250\end{verbatim}
248251
249This routine, which is called by \verb|iocInit| twice for each record of type \verb|xxx|, checks to see if it has a proper set of device 252This routine, which is called by \verb|iocInit| twice for each record of type \verb|xxx|, checks to see if it has a proper set of device support routines and, if present, calls the \verb|init_record| entry of the DSET.
250support routines and, if present, calls the \verb|init_record| entry of the DSET.
251253
252During the first call to \verb|init_record| (pass=0) only initializations relating to this record can be performed. During the 254During the first call to \verb|init_record| (pass=0) only initializations relating to this record can be performed.
253second call (pass=1) initializations that may refer to other records can be performed. Note also that during the second 255During the second call (pass=1) initializations that may refer to other records can be performed.
254pass, other records may refer to fields within this record. A good example of where these rules are important is a 256Note also that during the second pass, other records may refer to fields within this record.
255waveform record. The \verb|VAL| field of a waveform record actually refers to an array. The waveform record support module 257A good example of where these rules are important is a waveform record.
256must allocate storage for the array. If another record has a database link referring to the waveform \verb|VAL| field then the 258The \verb|VAL| field of a waveform record actually refers to an array.
257storage must be allocated before the link is resolved. This is accomplished by having the waveform record support 259The waveform record support module must allocate storage for the array.
258allocate the array during the first pass (pass=0) and having the link reference resolved during the second pass (pass=1).260If another record has a database link referring to the waveform \verb|VAL| field then the storage must be allocated before the link is resolved.
261This is accomplished by having the waveform record support allocate the array during the first pass (pass=0) and having the link reference resolved during the second pass (pass=1).
259262
260\subsection{process}263\subsection{process}
261264
@@ -294,18 +297,20 @@
294}297}
295\end{verbatim}298\end{verbatim}
296299
297The record processing routines are the heart of the IOC software. The record specific process routine is called by 300The record processing routines are the heart of the IOC software.
298\verb|dbProcess| whenever it decides that a record should be processed. Process decides what record processing really means. 301The record specific process routine is called by \verb|dbProcess| whenever it decides that a record should be processed.
299The above is a good example of what should be done. In addition to being called by \verb|dbProcess| the process routine may 302Process decides what record processing really means.
300also be called by asynchronous record completion routines.303The above is a good example of what should be done.
304In addition to being called by \verb|dbProcess| the process routine may also be called by asynchronous record completion routines.
301305
302The above model supports both synchronous and asynchronous device support routines. For example, if \verb|read_xxx| is an 306The above model supports both synchronous and asynchronous device support routines.
303asynchronous routine, the following sequence of events will occur:307For example, if \verb|read_xxx| is an asynchronous routine, the following sequence of events will occur:
304308
305\begin{itemize}309\begin{itemize}
306\item \verb|process| is called with \verb|pact| \verb|FALSE|310\item \verb|process| is called with \verb|pact| \verb|FALSE|
307311
308\item \verb|read_xxx| is called. Since \verb|pact| is \verb|FALSE| it starts I/O, arranges callback, and sets \verb|pact| \verb|TRUE|312\item \verb|read_xxx| is called.
313Since \verb|pact| is \verb|FALSE| it starts I/O, arranges callback, and sets \verb|pact| \verb|TRUE|
309314
310\item \verb|read_xxx| returns315\item \verb|read_xxx| returns
311316
@@ -315,7 +320,8 @@
315320
316\item Sometime later the callback occurs and \verb|process| is called again.321\item Sometime later the callback occurs and \verb|process| is called again.
317322
318\item \verb|read_xxx| is called. Since \verb|pact| is \verb|TRUE| it knows that it is a completion request.323\item \verb|read_xxx| is called.
324Since \verb|pact| is \verb|TRUE| it knows that it is a completion request.
319325
320\item \verb|read_xxx| returns326\item \verb|read_xxx| returns
321327
@@ -327,8 +333,8 @@
327333
328\end{itemize}334\end{itemize}
329335
330At this point the record has been completely processed. The next time \verb|process| is called everything starts all over from 336At this point the record has been completely processed.
331the beginning.337The next time \verb|process| is called everything starts all over from the beginning.
332338
333\subsection{Miscellaneous Utility Routines}339\subsection{Miscellaneous Utility Routines}
334340
@@ -359,8 +365,8 @@
359365
360\index{get\_units - .example}366\index{get\_units - .example}
361\index{get\_graphic\_double - example}367\index{get\_graphic\_double - example}
362These are a few examples of various routines supplied by a typical record support package. The functions that must be 368These are a few examples of various routines supplied by a typical record support package.
363performed by the remaining routines are described in the next section.369The functions that must be performed by the remaining routines are described in the next section.
364370
365\subsection{Alarm Processing}371\subsection{Alarm Processing}
366372
@@ -416,13 +422,14 @@
416}422}
417\end{verbatim}423\end{verbatim}
418424
419\index{checkAlarms}This is a typical set of code for checking alarms conditions for an analog type record. The actual set of code can be very 425\index{checkAlarms}This is a typical set of code for checking alarms conditions for an analog type record.
420record specific. Note also that other parts of the system can raise alarms. The algorithm is to always maximize alarm 426The actual set of code can be very record specific.
421severity, i.e. the highest severity outstanding alarm will be reported.427Note also that other parts of the system can raise alarms.
428The algorithm is to always maximize alarm severity, i.e. the highest severity outstanding alarm will be reported.
422429
423The above algorithm also honors a hysteresis factor for the alarm. This is to prevent alarm storms from occurring in the 430The above algorithm also honors a hysteresis factor for the alarm.
424event that the current value is very near an alarm limit and noise makes it continually cross the limit. It honors the 431This is to prevent alarm storms from occurring in the event that the current value is very near an alarm limit and noise makes it continually cross the limit.
425hysteresis only when the value is going to a lower alarm severity.432It honors the hysteresis only when the value is going to a lower alarm severity.
426433
427Note the test:434Note the test:
428435
@@ -433,30 +440,32 @@
433}440}
434\end{verbatim}441\end{verbatim}
435442
436\index{udf}Database common defines the field \index{UDF}UDF, which means that field VAL is undefined. The STAT and SEVR fields are 443\index{udf}Database common defines the field \index{UDF}UDF, which means that field VAL is undefined.
437initialized as though \verb|recGblSetSevr(pxxx,UDF_ALARM,VALID_ALARM)|was called. Thus if the record is never 444The STAT and SEVR fields are initialized as though \verb|recGblSetSevr(pxxx,UDF_ALARM,VALID_ALARM)|was called.
438processed the record will be in an INVALID UNDEFINED alarm state. Field UDF is initialized to the value 1, i.e. TRUE. 445Thus if the record is never processed the record will be in an INVALID UNDEFINED alarm state.
439Thus the above code will keep the record in the INVALID UNDEFINED alarm state as long as UDF is not given the 446Field UDF is initialized to the value 1, i.e. TRUE.
440value 0.447Thus the above code will keep the record in the INVALID UNDEFINED alarm state as long as UDF is not given the value 0.
441448
442The UDF field means Undefined, i.e. the VAL field has never been given a value. When records are loaded into an ioc this 449The UDF field means Undefined, i.e. the VAL field has never been given a value.
443is the initial state of records. Whevever code gives a value to the VAL field it is also supposed to set UDF false. Unless a 450When records are loaded into an ioc this is the initial state of records.
444particular record type has unusual semantics no code should set UDF true. UDF normally means that the field was never 451Whevever code gives a value to the VAL field it is also supposed to set UDF false.
445given a value.452Unless a particular record type has unusual semantics no code should set UDF true.
446453UDF normally means that the field was never given a value.
447For input records device support is responsible for obtaining an input value. If no input value can be obtained neither 454
448record support nor device support sets UDF false. If device support reads a raw value it returns a value telling record 455For input records device support is responsible for obtaining an input value.
449support to perform a conversion. After the record support sets VAL equal to the converted value, it sets UDF false. If 456If no input value can be obtained neither record support nor device support sets UDF false.
450device support obtains a converted value that it writes to VAL, it sets UDF false.457If device support reads a raw value it returns a value telling record support to perform a conversion.
451458After the record support sets VAL equal to the converted value, it sets UDF false.
452For output records either something outside record/device support writes to the VAL field or else VAL is given a value 459If device support obtains a converted value that it writes to VAL, it sets UDF false.
453because record support obtains a value via the OMSL field. In either case the code that writes to the VAL field sets UDF 460
454false.461For output records either something outside record/device support writes to the VAL field or else VAL is given a value because record support obtains a value via the OMSL field.
462In either case the code that writes to the VAL field sets UDF false.
455463
456Whenever database access writes to the VAL field it sets UDF false.464Whenever database access writes to the VAL field it sets UDF false.
457465
458Routine recGblSetSevr is called to raise alarms. It can be called by iocCore, record support, or device support. The code 466Routine recGblSetSevr is called to raise alarms.
459that detects an alarm is responsible for raising the alarm.467It can be called by iocCore, record support, or device support.
468The code that detects an alarm is responsible for raising the alarm.
460469
461\subsection{Raising Monitors}470\subsection{Raising Monitors}
462471
@@ -493,14 +502,16 @@
493}502}
494\end{verbatim}503\end{verbatim}
495504
496\index{monitor - example}All record types should call \verb|recGblResetAlarms| as shown. Note that \verb|nsta| and \verb|nsev| will have the value 0 after this 505\index{monitor - example}All record types should call \verb|recGblResetAlarms| as shown.
497routine completes. This is necessary to ensure that alarm checking starts fresh after processing completes. The code also 506Note that \verb|nsta| and \verb|nsev| will have the value 0 after this routine completes.
498takes care of raising alarm monitors when a record changes from an alarm state to the no alarm state. It is essential that 507This is necessary to ensure that alarm checking starts fresh after processing completes.
499record support routines follow the above model or else alarm processing will not follow the rules.508The code also takes care of raising alarm monitors when a record changes from an alarm state to the no alarm state.
509It is essential that record support routines follow the above model or else alarm processing will not follow the rules.
500510
501Analog type records should also provide monitor and archive hysteresis fields as shown by this example.511Analog type records should also provide monitor and archive hysteresis fields as shown by this example.
502512
503\verb|db_post_events| results in channel access issuing monitors for clients attached to the record and field. The call is513\verb|db_post_events| results in channel access issuing monitors for clients attached to the record and field.
514The call is
504515
505\begin{verbatim}516\begin{verbatim}
506int db_post_events(void *precord, void *pfield,517int db_post_events(void *precord, void *pfield,
@@ -517,7 +528,8 @@
517528
518\begin{description}529\begin{description}
519530
520\item \index{DBE\_ALARM}DBE\_ALARM - A change of alarm state has occured. This is set by \verb|recGblResetAlarms|.531\item \index{DBE\_ALARM}DBE\_ALARM - A change of alarm state has occured.
532This is set by \verb|recGblResetAlarms|.
521533
522\item \index{DBE\_LOG}DBE\_LOG - Archive change of state.534\item \index{DBE\_LOG}DBE\_LOG - Archive change of state.
523535
@@ -526,13 +538,14 @@
526\end{description}538\end{description}
527539
528\end{description}540\end{description}
529IMPORTANT: The record support module is responsible for calling \verb|db_post_event| for any fields that change as a 541IMPORTANT:
530result of record processing. Also it should NOT call \verb|db_post_event| for fields that do not change.542The record support module is responsible for calling \verb|db_post_event| for any fields that change as a result of record processing.
543Also it should NOT call \verb|db_post_event| for fields that do not change.
531544
532\section{Record Support Routines}545\section{Record Support Routines}
533546
534This section describes the routines defined in the RSET. Any routine that does not apply to a specific record type must be 547This section describes the routines defined in the RSET.
535declared \verb|NULL|.548Any routine that does not apply to a specific record type must be declared \verb|NULL|.
536549
537\subsection{Generate Report of Each Field in Record}550\subsection{Generate Report of Each Field in Record}
538551
@@ -540,7 +553,8 @@
540report(void *precord); /* addr of record*/553report(void *precord); /* addr of record*/
541\end{verbatim}554\end{verbatim}
542555
543\index{report - Record Support Routine}This routine is not used by most record types. Any action is record type specific.556\index{report - Record Support Routine}This routine is not used by most record types.
557Any action is record type specific.
544558
545\subsection{Initialize Record Processing}559\subsection{Initialize Record Processing}
546560
@@ -548,8 +562,9 @@
548initialize(void);562initialize(void);
549\end{verbatim}563\end{verbatim}
550564
551\index{init - Record Support Routine}This routine is called once at IOC initialization time. Any action is record type specific. Most record types do not need 565\index{init - Record Support Routine}This routine is called once at IOC initialization time.
552this routine.566Any action is record type specific.
567Most record types do not need this routine.
553568
554\subsection{Initialize Specific Record}569\subsection{Initialize Specific Record}
555570
@@ -559,15 +574,15 @@
559 int pass);574 int pass);
560\end{verbatim}575\end{verbatim}
561576
562\index{init\_record - record support routine}\verb|iocInit| calls this routine twice (pass=0 and pass=1) for each database record of the type handled by this routine. It must 577\index{init\_record - record support routine}\verb|iocInit| calls this routine twice (pass=0 and pass=1) for each database record of the type handled by this routine.
563perform the following functions:578It must perform the following functions:
564579
565\begin{itemize}580\begin{itemize}
566\item Check and/or issue initialization calls for the associated device support routines.581\item Check and/or issue initialization calls for the associated device support routines.
567582
568\item Perform any record type specific initialization.583\item Perform any record type specific initialization.
569584
570\item During the first pass it can only perform initializations that affect the record referenced by precord. 585\item During the first pass it can only perform initializations that affect the record referenced by precord.
571586
572\item During the second pass it can perform initializations that affect other records.587\item During the second pass it can perform initializations that affect other records.
573588
@@ -589,16 +604,20 @@
589 int after);/*(FALSE,TRUE)=>(Before,After)Processing*/604 int after);/*(FALSE,TRUE)=>(Before,After)Processing*/
590\end{verbatim}605\end{verbatim}
591606
592\index{special - Record Support Routine}This routine implements the record type specific special processing for the field referred to by \verb|dbAddr|. Note that it is 607\index{special - Record Support Routine}This routine implements the record type specific special processing for the field referred to by \verb|dbAddr|.
593called twice. Once before any changes are made to the associated field and once after. File \verb|special.h| defines special 608Note that it is called twice.
594types. This routine is only called for user special fields, i.e. fields with \verb|SPC_xxx| \textgreater{}= 100. A field is declared special in the 609Once before any changes are made to the associated field and once after.
595ASCII record definition file. New values should not by added to \verb|special.h|, instead use \verb|SPC_MOD|.610File \verb|special.h| defines special types.
611This routine is only called for user special fields, i.e. fields with \verb|SPC_xxx| \textgreater{}= 100.
612A field is declared special in the ASCII record definition file.
613New values should not by added to \verb|special.h|, instead use \verb|SPC_MOD|.
596614
597The database access routine, \verb|dbGetFieldIndex| can be used to determine which field is being modified.615The database access routine, \verb|dbGetFieldIndex| can be used to determine which field is being modified.
598616
599\subsection{Get Value}617\subsection{Get Value}
600618
601This routine is no longer used. It should be left as a NULL procedure in the record support entry table.619This routine is no longer used.
620It should be left as a NULL procedure in the record support entry table.
602621
603\subsection{Convert dbAddr Definitions}622\subsection{Convert dbAddr Definitions}
604623
@@ -606,18 +625,20 @@
606cvt_dbaddr(struct dbAddr *paddr);625cvt_dbaddr(struct dbAddr *paddr);
607\end{verbatim}626\end{verbatim}
608627
609\index{cvt\_dbaddr - Record Support Routine}This routine is called by \verb|dbNameToAddr| if the field has special set equal to \verb|SPC_DBADDR|. A typical use is when a field 628\index{cvt\_dbaddr - Record Support Routine}This routine is called by \verb|dbNameToAddr| if the field has special set equal to \verb|SPC_DBADDR|.
610refers to an array. This routine can change any combination of the \verb|dbAddr| fields: \verb|no_elements|, \verb|field_type|, 629A typical use is when a field refers to an array.
611\verb|field_size|, \verb|special,pfield, |and\verb| dbr_type|. For example if the \verb|VAL| field of a waveform record is passed to 630This routine can change any combination of the \verb|dbAddr| fields:
612\verb|dbNameToAddr|, \verb|cvt_dbaddr| would change \verb|dbAddr| so that it refers to the actual array rather then \verb|VAL|.631\verb|no_elements|, \verb|field_type|, \verb|field_size|, \verb|special,pfield, |and\verb| dbr_type|.
632For example if the \verb|VAL| field of a waveform record is passed to \verb|dbNameToAddr|, \verb|cvt_dbaddr| would change \verb|dbAddr| so that it refers to the actual array rather then \verb|VAL|.
613633
614The database access routine, \verb|dbGetFieldIndex| can be used to determine which field is being modified.634The database access routine, \verb|dbGetFieldIndex| can be used to determine which field is being modified.
615635
616NOTES:636NOTES:
617637
618\begin{itemize}638\begin{itemize}
619\item Channel access calls db\_name\_to\_addr, which is part of old database access. Db\_name\_to\_addr calls 639\item Channel access calls \verb|db_name_to_addr|, which is part of old database access.
620dbNameToAddr. This is done when a client connects to the record.640\verb|db_name_to_addr| calls \verb|dbNameToAddr|.
641This is done when a client connects to the record.
621642
622\item no\_elements must be set to the maximum number of elements that will ever be stored in the array.643\item no\_elements must be set to the maximum number of elements that will ever be stored in the array.
623644
@@ -632,11 +653,12 @@
632 long *offset);653 long *offset);
633\end{verbatim}654\end{verbatim}
634655
635\index{get\_array\_info - Record Support Routine}This routine returns the current number of elements and the offset of the first value of the specified array. The offset field 656\index{get\_array\_info - Record Support Routine}This routine returns the current number of elements and the offset of the first value of the specified array.
636is meaningful if the array is actually a circular buffer.657The offset field is meaningful if the array is actually a circular buffer.
637658
638The database access routine, \verb|dbGetFieldIndex| can be used to determine which field is being modified. It is 659The database access routine, \verb|dbGetFieldIndex| can be used to determine which field is being modified.
639permissible for \verb|get_array_info| to change \verb|pfield|. This feature can be used to implement double buffering.660It is permissible for \verb|get_array_info| to change \verb|pfield|.
661This feature can be used to implement double buffering.
640662
641\index{get\_array\_info - Record Support Routine}663\index{get\_array\_info - Record Support Routine}
642When an array field is being written \verb|get_array_info| is called before the field values are changed.664When an array field is being written \verb|get_array_info| is called before the field values are changed.
@@ -673,8 +695,9 @@
673 long *precision);695 long *precision);
674\end{verbatim}696\end{verbatim}
675697
676\index{get\_precision - Record Support Routine}This routine gets the precision, i.e. number of decimal places, which should be used to convert the field value to an ASCII 698\index{get\_precision - Record Support Routine}This routine gets the precision, i.e.
677string. \verb|recGblGetPrec| should be called for fields not directly related to the value field.699number of decimal places, which should be used to convert the field value to an ASCII string.
700\verb|recGblGetPrec| should be called for fields not directly related to the value field.
678701
679The database access routine, \verb|dbGetFieldIndex| can be used to determine which field is being modified.702The database access routine, \verb|dbGetFieldIndex| can be used to determine which field is being modified.
680703
@@ -686,7 +709,8 @@
686 char *p);709 char *p);
687\end{verbatim}710\end{verbatim}
688711
689\index{get\_enum\_str - record Support Routine}This routine sets \verb|*p| equal to the ASCII string for the field value. The field must have type \verb|DBF_ENUM|.712\index{get\_enum\_str - record Support Routine}This routine sets \verb|*p| equal to the ASCII string for the field value.
713The field must have type \verb|DBF_ENUM|.
690714
691Look at the code for the \verb|bi| or \verb|mbbi| records for examples.715Look at the code for the \verb|bi| or \verb|mbbi| records for examples.
692716
@@ -714,8 +738,8 @@
714 char *p);738 char *p);
715\end{verbatim}739\end{verbatim}
716740
717\index{put\_enum\_str - Record Support Routine}Given an ASCII string, this routine updates the database field. It compares the string with the string values associated with 741\index{put\_enum\_str - Record Support Routine}Given an ASCII string, this routine updates the database field.
718each enumerated value and if it finds a match sets the database field equal to the index of the string which matched.742It compares the string with the string values associated with each enumerated value and if it finds a match sets the database field equal to the index of the string which matched.
719743
720Look at the code for the \verb|bi| or \verb|mbbi| records for examples.744Look at the code for the \verb|bi| or \verb|mbbi| records for examples.
721745
@@ -729,8 +753,8 @@
729 struct dbr_grDouble *p); /* addr of return info*/753 struct dbr_grDouble *p); /* addr of return info*/
730\end{verbatim}754\end{verbatim}
731755
732\index{get\_graphic\_double - Record Support Routine}This routine fills in the graphics related fields of structure \verb|dbr_grDouble|. \verb|recGblGetGraphicDouble| should be 756\index{get\_graphic\_double - Record Support Routine}This routine fills in the graphics related fields of structure \verb|dbr_grDouble|.
733called for fields not directly related to the value field.757\verb|recGblGetGraphicDouble| should be called for fields not directly related to the value field.
734758
735The database access routine, \verb|dbGetFieldIndex| can be used to determine which field is being modified.759The database access routine, \verb|dbGetFieldIndex| can be used to determine which field is being modified.
736760
@@ -742,8 +766,8 @@
742 struct dbr_ctrlDouble *p); /* addr of return info*/766 struct dbr_ctrlDouble *p); /* addr of return info*/
743\end{verbatim}767\end{verbatim}
744768
745\index{get\_control\_double - Record Support Routine}This routine gives values to all fields of structure \verb|dbr_ctrlDouble|. \verb|recGblGetControlDouble| should be called 769\index{get\_control\_double - Record Support Routine}This routine gives values to all fields of structure \verb|dbr_ctrlDouble|.
746for fields not directly related to the value field.770\verb|recGblGetControlDouble| should be called for fields not directly related to the value field.
747771
748The database access routine, \verb|dbGetFieldIndex| can be used to determine which field is being modified.772The database access routine, \verb|dbGetFieldIndex| can be used to determine which field is being modified.
749773
@@ -762,26 +786,30 @@
762\section{Global Record Support Routines}786\section{Global Record Support Routines}
763787
764\index{Global Record Support Routines}788\index{Global Record Support Routines}
765A number of global record support routines are available. These routines are intended for use by the record specific 789A number of global record support routines are available.
766processing routines but can be called by any routine that wishes to use their services.790These routines are intended for use by the record specific processing routines but can be called by any routine that wishes to use their services.
767791
768The name of each of these routines begins with ``\verb|recGbl|".792The name of each of these routines begins with ``\verb|recGbl|".
769793
770\subsection{Alarm Status and Severity}794\subsection{Alarm Status and Severity}
771795
772Alarms may be raised in many different places during the course of record processing. The algorithm is to maximize the 796Alarms may be raised in many different places during the course of record processing.
773alarm severity, i.e. the highest severity outstanding alarm is raised. If more than one alarm of the same severity is found 797The algorithm is to maximize the alarm severity, i.e. the highest severity outstanding alarm is raised.
774then the first one is reported. This means that whenever a code fragment wants to raise an alarm, it does so only if the 798If more than one alarm of the same severity is found then the first one is reported.
775alarm severity it will declare is greater then that already existing. Four fields (in database common) are used to implement 799This means that whenever a code fragment wants to raise an alarm, it does so only if the alarm severity it will declare is greater then that already existing.
776alarms: \verb|sevr|, \verb|stat|, \verb|nsev|, and \verb|nsta|. The first two are the status and severity after the record is completely processed. 800Four fields (in database common) are used to implement alarms:
777The last two fields (\verb|nsta| and \verb|nsev|) are the status and severity values to set during record processing. Two routines are 801\verb|sevr|, \verb|stat|, \verb|nsev|, and \verb|nsta|.
778used for handling alarms. Whenever a routine wants to raise an alarm it calls \verb|recGblSetSevr|. This routine will only 802The first two are the status and severity after the record is completely processed.
779change \verb|nsta| and \verb|nsev| if it will result in the alarm severity being increased. At the end of processing, the record support 803The last two fields (\verb|nsta| and \verb|nsev|) are the status and severity values to set during record processing.
780module must call \verb|recGblResetAlarms|. This routine sets \verb|stat = nsta|, \verb|sevr = nsev|, \verb|nsta= 0|, and \verb|nsev = 0|. If \verb|stat| 804Two routines are used for handling alarms.
781or \verb|sevr| has changed value since the last call it calls \verb|db_post_event| for \verb|stat| and \verb|sevr| and returns a value of 805Whenever a routine wants to raise an alarm it calls \verb|recGblSetSevr|.
782\verb|DBE_ALARM|. If no change occured it returns 0. Thus after calling \verb|recGblResetAlarms| everything is ready for raising 806This routine will only change \verb|nsta| and \verb|nsev| if it will result in the alarm severity being increased.
783alarms the next time the record is processed. The example record support module presented above shows how these 807At the end of processing, the record support module must call \verb|recGblResetAlarms|.
784macros are used.808This routine sets \verb|stat = nsta|, \verb|sevr = nsev|, \verb|nsta= 0|, and \verb|nsev = 0|.
809If \verb|stat| or \verb|sevr| has changed value since the last call it calls \verb|db_post_event| for \verb|stat| and \verb|sevr| and returns a value of \verb|DBE_ALARM|.
810If no change occured it returns 0.
811Thus after calling \verb|recGblResetAlarms| everything is ready for raising alarms the next time the record is processed.
812The example record support module presented above shows how these macros are used.
785813
786\begin{verbatim}814\begin{verbatim}
787recGblSetSevr(815recGblSetSevr(
@@ -790,7 +818,7 @@
790short nsevr);818short nsevr);
791\end{verbatim}819\end{verbatim}
792820
793\index{recGblSetSevr}Returns: (\verb|TRUE|, \verb|FALSE|) if (did, did not) change \verb|nsta| and \verb|nsev|.821\index{recGblSetSevr}Returns \verb|TRUE| if it changed \verb|nsta| and/or \verb|nsev|, \verb|FALSE| if it did not change them.
794822
795\begin{verbatim}823\begin{verbatim}
796unsigned short recGblResetAlarms(void *precord);824unsigned short recGblResetAlarms(void *precord);
@@ -800,9 +828,10 @@
800828
801\subsection{Alarm Acknowledgment}829\subsection{Alarm Acknowledgment}
802830
803Database common contains two additional alarm related fields: \verb|acks| (Highest severity unacknowledged alarm) and 831Database common contains two additional alarm related fields:
804\verb|ackt| (does transient alarm need to be acknowledged). These field are handled by \verb|iocCore| and \verb|recGblResetAlarms| 832\verb|acks| (Highest severity unacknowledged alarm) and \verb|ackt| (does transient alarm need to be acknowledged).
805and are not the responsibility of record support. These fields are intended for use by the alarm handler.833These field are handled by \verb|iocCore| and \verb|recGblResetAlarms| and are not the responsibility of record support.
834These fields are intended for use by the alarm handler.
806835
807\subsection{Generate Error: Process Variable Name, Caller, Message}836\subsection{Generate Error: Process Variable Name, Caller, Message}
808837
@@ -815,8 +844,8 @@
815 char *pcaller_name); /* calling routine name */844 char *pcaller_name); /* calling routine name */
816\end{verbatim}845\end{verbatim}
817846
818\index{recGblDbaddrError}This routine interfaces with the system wide error handling system to display the following information: Status 847\index{recGblDbaddrError}This routine interfaces with the system wide error handling system to display the following information:
819information, process variable name, calling routine.848Status information, process variable name, calling routine.
820849
821\subsection{Generate Error: Status String, Record Name, Caller}850\subsection{Generate Error: Status String, Record Name, Caller}
822SUGGESTION: use errlogPrintf instead of this for new code.851SUGGESTION: use errlogPrintf instead of this for new code.
@@ -829,8 +858,8 @@
829858
830\index{errlogPrintf}859\index{errlogPrintf}
831\index{recGblRecordError}860\index{recGblRecordError}
832This routine interfaces with the system wide error handling system to display the following information: Status 861This routine interfaces with the system wide error handling system to display the following information:
833information, record name, calling routine.862Status information, record name, calling routine.
834863
835\subsection{Generate Error: Record Name, Caller, Record Support Message}864\subsection{Generate Error: Record Name, Caller, Record Support Message}
836SUGGESTION: use errlogPrintf instead of this for new code.865SUGGESTION: use errlogPrintf instead of this for new code.
@@ -844,8 +873,8 @@
844873
845\index{errlogPrintf}874\index{errlogPrintf}
846\index{recGblRecsupError}875\index{recGblRecsupError}
847This routine interfaces with the system wide error handling system to display the following information: Status 876This routine interfaces with the system wide error handling system to display the following information:
848information, record name, calling routine, record support entry name.877Status information, record name, calling routine, record support entry name.
849878
850\subsection{Get Graphics Double}879\subsection{Get Graphics Double}
851880
@@ -900,8 +929,8 @@
900\index{recGblGetTimeStamp}This routine gets the current time stamp and puts it in the record It does the following:929\index{recGblGetTimeStamp}This routine gets the current time stamp and puts it in the record It does the following:
901930
902\begin{itemize}931\begin{itemize}
903\item If TSEL is not a constant link and TSEL refers to the TIME field of a record, the time is obtained from the record 932\item If TSEL is not a constant link and TSEL refers to the TIME field of a record, the time is obtained from the record reference by TSEL and this put in field TIME.
904reference by TSEL and this put in field TIME. The routine then returns.933The routine then returns.
905934
906\item If TSEL is not a constant link dbGetLink is called and the value put in field TSE.935\item If TSEL is not a constant link dbGetLink is called and the value put in field TSE.
907936
@@ -929,5 +958,6 @@
929 void *pdest);958 void *pdest);
930\end{verbatim}959\end{verbatim}
931960
932\index{recGblInitConstantLink}Initialize a constant link. This routine is usually called by \verb|init_record| (or by associated device support) to initialize 961\index{recGblInitConstantLink}Initialize a constant link.
933the field associated with a constant link. It returns(FALSE, TRUE) if it (did not, did) modify the destination.962This routine is usually called by \verb|init_record| (or by associated device support) to initialize the field associated with a constant link.
963It returns(FALSE, TRUE) if it (did not, did) modify the destination.

Subscribers

People subscribed via source and target branches