Skip to content

Commit ffb84ab

Browse files
committed
Add ASYN_TRACE_STATE
Sometimes it is useful to have a trace level between WARNING and FLOW to debug drivers and hardware. In case of a motor, for example, it will show when the motor starts or stops, without all the poll() messages. For a temperatur controller it may be new set points send to the device, or information when the heater is turned on or off.
1 parent 639d007 commit ffb84ab

4 files changed

Lines changed: 22 additions & 2 deletions

File tree

asyn/asynDriver/asynDriver.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ typedef struct asynLockPortNotify {
197197
#define ASYN_TRACEIO_DRIVER 0x0008
198198
#define ASYN_TRACE_FLOW 0x0010
199199
#define ASYN_TRACE_WARNING 0x0020
200+
#define ASYN_TRACE_STATE 0x0040
200201

201202
/* traceIO mask definitions*/
202203
#define ASYN_TRACEIO_NODATA 0x0000

asyn/asynRecord/asynRecord.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ typedef struct oldValues { /* Used in monitor() and monitorStatus() */
188188
epicsEnum16 tb3; /* Trace IO driver */
189189
epicsEnum16 tb4; /* Trace flow */
190190
epicsEnum16 tb5; /* Trace warning */
191+
epicsEnum16 tb6; /* Trace state */
191192
epicsInt32 tiom; /* Trace I/O mask */
192193
epicsEnum16 tib0; /* Trace IO ASCII */
193194
epicsEnum16 tib1; /* Trace IO escape */
@@ -412,12 +413,14 @@ static long special(struct dbAddr * paddr, int after)
412413
case asynRecordTB3:
413414
case asynRecordTB4:
414415
case asynRecordTB5:
416+
case asynRecordTB6:
415417
traceMask = (pasynRec->tb0 ? ASYN_TRACE_ERROR : 0) |
416418
(pasynRec->tb1 ? ASYN_TRACEIO_DEVICE : 0) |
417419
(pasynRec->tb2 ? ASYN_TRACEIO_FILTER : 0) |
418420
(pasynRec->tb3 ? ASYN_TRACEIO_DRIVER : 0) |
419421
(pasynRec->tb4 ? ASYN_TRACE_FLOW : 0) |
420-
(pasynRec->tb5 ? ASYN_TRACE_WARNING : 0);
422+
(pasynRec->tb5 ? ASYN_TRACE_WARNING : 0) |
423+
(pasynRec->tb6 ? ASYN_TRACE_STATE : 0);
421424
pasynTrace->setTraceMask(pasynUser, traceMask);
422425
return 0;
423426
case asynRecordTIOM:
@@ -1044,6 +1047,7 @@ static void monitorStatus(asynRecord * pasynRec)
10441047
REMEMBER_STATE(tb3);
10451048
REMEMBER_STATE(tb4);
10461049
REMEMBER_STATE(tb5);
1050+
REMEMBER_STATE(tb6);
10471051
REMEMBER_STATE(tiom);
10481052
REMEMBER_STATE(tib0);
10491053
REMEMBER_STATE(tib1);
@@ -1066,6 +1070,7 @@ static void monitorStatus(asynRecord * pasynRec)
10661070
pasynRec->tb3 = (traceMask & ASYN_TRACEIO_DRIVER) ? 1 : 0;
10671071
pasynRec->tb4 = (traceMask & ASYN_TRACE_FLOW) ? 1 : 0;
10681072
pasynRec->tb5 = (traceMask & ASYN_TRACE_WARNING) ? 1 : 0;
1073+
pasynRec->tb6 = (traceMask & ASYN_TRACE_STATE) ? 1 : 0;
10691074
traceMask = pasynTrace->getTraceIOMask(pasynUser);
10701075
pasynRec->tiom = traceMask;
10711076
pasynRec->tib0 = (traceMask & ASYN_TRACEIO_ASCII) ? 1 : 0;
@@ -1101,6 +1106,7 @@ static void monitorStatus(asynRecord * pasynRec)
11011106
POST_IF_NEW(tb3);
11021107
POST_IF_NEW(tb4);
11031108
POST_IF_NEW(tb5);
1109+
POST_IF_NEW(tb6);
11041110
POST_IF_NEW(tiom);
11051111
POST_IF_NEW(tib0);
11061112
POST_IF_NEW(tib1);

asyn/asynRecord/asynRecord.dbd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,13 @@ recordtype(asyn) {
520520
interest(1)
521521
menu(asynTRACE)
522522
}
523+
field(TB6,DBF_MENU) {
524+
prompt("Trace state")
525+
promptgroup(GUI_DISPLAY)
526+
special(SPC_MOD)
527+
interest(1)
528+
menu(asynTRACE)
529+
}
523530
field(TIOM,DBF_LONG) {
524531
prompt("Trace I/O mask")
525532
promptgroup(GUI_DISPLAY)

documentation/asynRecord.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1413,6 +1413,12 @@ <h2 id="TraceControlFields" style="text-align: center">
14131413
R/W</td>
14141414
<td>
14151415
"Trace warning"</td>
1416+
<td>
1417+
TB6</td>
1418+
<td>
1419+
R/W</td>
1420+
<td>
1421+
"Trace state"</td>
14161422
<td>
14171423
DBF_MENU</td>
14181424
<td>
@@ -1557,7 +1563,7 @@ <h2 id="TraceControlFields" style="text-align: center">
15571563
The above fields are used to control the asynTrace facility. They allow one to turn
15581564
on and off debugging output printed at the shell or written to the trace file.</p>
15591565
<p>
1560-
The TMSK field allows one to read/write the entire asynTraceMask word. The TB0-TB5
1566+
The TMSK field allows one to read/write the entire asynTraceMask word. The TB0-TB6
15611567
fields allow one to read/write the individual bits in asynTraceMask. The TIOM field
15621568
allows one to read/write the entire asynTraceIOMask word, and the TIB0-TIB2 fields
15631569
allow one to read/write the individual bits in asynTraceIOMask. The TINM field allows

0 commit comments

Comments
 (0)