Added seqcaStats routine, returns CA channel count information.
Annotate for file src/seq/seqCom.h
2000-04-04 William 1 /* * base/include seqCom.h,v 1.3 1995/10/10 01:25:08 wright Exp
03:23:15 ' 2 *
' 3 * DESCRIPTION: Common defs for state programs and run-time sequencer.
' 4 *
' 5 * Author: Andy Kozubal
' 6 * Date: 01mar94
' 7 *
' 8 * Experimental Physics and Industrial Control System (EPICS)
' 9 *
' 10 * Copyright 1993 the Regents of the University of California,
' 11 * and the University of Chicago Board of Governors.
' 12 *
' 13 * This software was produced under U.S. Government contracts:
' 14 * (W-7405-ENG-36) at the Los Alamos National Laboratory,
' 15 * and (W-31-109-ENG-38) at Argonne National Laboratory.
' 16 *
' 17 * Initial development by:
' 18 * The Controls and Automation Group (AT-8)
' 19 * Ground Test Accelerator
' 20 * Accelerator Technology Division
' 21 * Los Alamos National Laboratory
' 22 * Modification Log:
' 23 * -----------------
' 24 * 11jul96,ajk Changed all int types to long.
' 25 * 22jul96,ajk Changed PFUNC to ACTION_FUNC, EVENT_FUNC, DELAY_FUNC, EXIT_FUNC.
' 26 * 08aug96,wfl Changed magic number; added syncQ queue support.
' 27 * 13aug96,wfl Added pvFreeQ() declaration.
' 28 * 29apr99,wfl Tidied, removed tsDefs.h, used SEQ_TIME_STAMP; removed vx_opt.
' 29 * 17may99,wfl Added stdlib.h and seq() prototype.
' 30 * 06jul99,wfl Replaced OPT_TIME with OPT_MAIN; made bitMask unsigned long.
' 31 * 07sep99,wfl Changed magic number (arg lists have changed);
' 32 * added SYNC/ASYNC arguments to seq_pvGet() and seq_pvPut();
' 33 * added seq_pvXxx() (Xxx=Name,Message,PutComplete).
' 34 * 22sep99,grw Supported entry and exit actions; supported state options.
' 35 * 29feb00,wfl Converted to new OSI; new magic number.
' 36 * 31mar00,wfl Included pvAlarm.h; added entry function; new magic number.
' 37 */
' 38 #ifndef INCLseqComh
' 39 #define INCLseqComh
' 40
2001-03-22 Marty 41 #ifndef SEQ_UGLY_WINDOWS_HACK
2000-04-04 William 42 #include <stdio.h> /* standard i/o defs */
03:23:15 ' 43 #include <stdlib.h> /* standard library defs */
' 44
2000-04-14 Janet 45 #include "shareLib.h" /* reset share lib defines */
2000-04-04 William 46 #include "pvAlarm.h" /* status and severity defs */
2001-03-19 Marty 47 #include "epicsThread.h" /* time stamp defs */
2001-02-16 Marty 48 #include "epicsTime.h" /* time stamp defs */
2003-09-08 Andrew 49 #include "epicsExport.h" /* for Registrar routine */
2001-03-22 Marty 50 #endif
2000-04-04 William 51
2001-02-16 W. 52 #ifdef __cplusplus
21:45:18 ' 53 extern "C" {
' 54 #endif
' 55
2000-04-04 William 56 #define MAGIC 20000315 /* current magic number for SPROG (yyyymmdd) */
03:23:15 ' 57
' 58 /* Bit encoding for run-time options */
' 59 #define OPT_DEBUG (1<<0) /* turn on debugging */
' 60 #define OPT_ASYNC (1<<1) /* use async. gets */
' 61 #define OPT_CONN (1<<2) /* wait for all connections */
' 62 #define OPT_REENT (1<<3) /* generate reentrant code */
' 63 #define OPT_NEWEF (1<<4) /* new event flag mode */
' 64 #define OPT_MAIN (1<<5) /* generate main program */
' 65
' 66 /* Bit encoding for State Specific Options */
' 67 #define OPT_NORESETTIMERS (1<<0) /* If TRUE, don't reset timers on */
' 68 /* entry to state from same state */
' 69 #define OPT_DOENTRYFROMSELF (1<<1) /* Do entry{} even if from same state */
' 70 #define OPT_DOEXITTOSELF (1<<2) /* Do exit{} even if to same state */
' 71
' 72 /* Macros to handle set & clear event bits */
' 73 typedef unsigned long bitMask;
' 74 #define NBITS (8*sizeof(bitMask))
' 75 /* # bits in bitMask word */
' 76
' 77 #define bitSet(word, bitnum) (word[(bitnum)/NBITS] |= (1<<((bitnum)%NBITS)))
' 78 #define bitClear(word, bitnum) (word[(bitnum)/NBITS] &= ~(1<<((bitnum)%NBITS)))
' 79 #define bitTest(word, bitnum) ((word[(bitnum)/NBITS] & (1<<((bitnum)%NBITS))) != 0)
' 80
' 81 #ifndef TRUE
' 82 #define TRUE 1
' 83 #define FALSE 0
' 84 #endif /*TRUE*/
' 85
' 86 typedef long SS_ID; /* state set id */
' 87
' 88 /* Prototype for action, event, delay, and exit functions */
' 89 typedef long (*PFUNC)();
' 90 typedef void (*ACTION_FUNC)();
' 91 typedef long (*EVENT_FUNC)();
' 92 typedef void (*DELAY_FUNC)();
' 93 typedef void (*ENTRY_FUNC)();
' 94 typedef void (*EXIT_FUNC)();
' 95
' 96 #ifdef OFFSET
' 97 #undef OFFSET
' 98 #endif
' 99 /* The OFFSET macro calculates the byte offset of a structure member
' 100 * from the start of a structure */
' 101 #define OFFSET(structure, member) ((long) &(((structure *) 0) -> member))
' 102
' 103 /* Structure to hold information about database channels */
' 104 struct seqChan
' 105 {
' 106 char *dbAsName; /* assigned channel name */
' 107 void *pVar; /* ptr to variable (-r option)
' 108 * or structure offset (+r option) */
' 109 char *pVarName; /* variable name, including subscripts*/
' 110 char *pVarType; /* variable type, e.g. "int" */
' 111 long count; /* element count for arrays */
' 112 long eventNum; /* event number for this channel */
' 113 long efId; /* event flag id if synced */
' 114 long monFlag; /* TRUE if channel is to be monitored */
' 115 int queued; /* TRUE if queued via syncQ */
' 116 int maxQueueSize; /* max syncQ queue size (0 => def) */
' 117 int queueIndex; /* syncQ queue index */
' 118 };
' 119
' 120 /* Structure to hold information about a state */
' 121 struct seqState
' 122 {
' 123 char *pStateName; /* state name */
' 124 ACTION_FUNC actionFunc; /* action routine for this state */
' 125 EVENT_FUNC eventFunc; /* event routine for this state */
' 126 DELAY_FUNC delayFunc; /* delay setup routine for this state */
' 127 ENTRY_FUNC entryFunc; /* statements performed on entry to state */
' 128 EXIT_FUNC exitFunc; /* statements performed on exit from state */
' 129 bitMask *pEventMask; /* event mask for this state */
' 130 bitMask options; /* State specific option mask */
' 131 };
' 132
' 133 /* Structure to hold information about a State Set */
' 134 struct seqSS
' 135 {
' 136 char *pSSName; /* state set name */
' 137 struct seqState *pStates; /* array of state blocks */
' 138 long numStates; /* number of states in this state set */
' 139 long errorState; /* error state index (-1 if none defd)*/
' 140 };
' 141
' 142 /* All information about a state program */
' 143 struct seqProgram
' 144 {
' 145 long magic; /* magic number */
' 146 char *pProgName; /* program name (for debugging) */
' 147 struct seqChan *pChan; /* table of channels */
' 148 long numChans; /* number of db channels */
' 149 struct seqSS *pSS; /* array of state set info structs */
' 150 long numSS; /* number of state sets */
' 151 long varSize; /* # bytes in user variable area */
' 152 char *pParams; /* program paramters */
' 153 long numEvents; /* number of event flags */
' 154 long options; /* options (bit-encoded) */
' 155 ENTRY_FUNC entryFunc; /* entry function */
' 156 EXIT_FUNC exitFunc; /* exit function */
' 157 int numQueues; /* number of syncQ queues */
' 158 };
' 159
' 160 /*
' 161 * Function declarations for interface between state program & sequencer.
' 162 * Notes:
' 163 * "seq_" is added by SNC to guarantee global uniqueness.
' 164 * These functions appear in the module seq_if.c.
' 165 * The SNC must generate these modules--see gen_ss_code.c.
' 166 */
' 167 #ifndef INCLseqh /* prefer more-specific seq.h prototype */
' 168 #endif
2000-04-14 Janet 169 epicsShareFunc void epicsShareAPI seq_efSet(SS_ID, long); /* set an event flag */
21:55:19 ' 170 epicsShareFunc long epicsShareAPI seq_efTest(SS_ID, long); /* test an event flag */
' 171 epicsShareFunc long epicsShareAPI seq_efClear(SS_ID, long); /* clear an event flag */
' 172 epicsShareFunc long epicsShareAPI seq_efTestAndClear(SS_ID, long);/* test & clear an event flag */
' 173 epicsShareFunc long epicsShareAPI seq_pvGet(SS_ID, long, long); /* get pv value */
' 174 epicsShareFunc int epicsShareAPI seq_pvGetQ(SS_ID, int); /* get queued pv value */
' 175 epicsShareFunc int epicsShareAPI seq_pvFreeQ(SS_ID, int); /* free elements on pv queue */
' 176 epicsShareFunc long epicsShareAPI seq_pvPut(SS_ID, long, long); /* put pv value */
2001-02-16 Marty 177 epicsShareFunc epicsTimeStamp epicsShareAPI seq_pvTimeStamp(SS_ID, long); /* get time stamp value */
2000-04-14 Janet 178 epicsShareFunc long epicsShareAPI seq_pvAssign(SS_ID, long, char *);/* assign/connect to a pv */
21:55:19 ' 179 epicsShareFunc long epicsShareAPI seq_pvMonitor(SS_ID, long); /* enable monitoring on pv */
' 180 epicsShareFunc long epicsShareAPI seq_pvStopMonitor(SS_ID, long); /* disable monitoring on pv */
' 181 epicsShareFunc char *epicsShareAPI seq_pvName(SS_ID, long); /* returns pv name */
' 182 epicsShareFunc long epicsShareAPI seq_pvStatus(SS_ID, long); /* returns pv alarm status code */
' 183 epicsShareFunc long epicsShareAPI seq_pvSeverity(SS_ID, long); /* returns pv alarm severity */
' 184 epicsShareFunc char *epicsShareAPI seq_pvMessage(SS_ID, long); /* returns pv error message */
' 185 epicsShareFunc long epicsShareAPI seq_pvAssigned(SS_ID, long); /* returns TRUE if assigned */
' 186 epicsShareFunc long epicsShareAPI seq_pvConnected(SS_ID, long); /* TRUE if connected */
' 187 epicsShareFunc long epicsShareAPI seq_pvGetComplete(SS_ID, long); /* TRUE if last get completed */
' 188 epicsShareFunc long epicsShareAPI seq_pvPutComplete(SS_ID, long, long, long, long *);
' 189 /* TRUE if last put completed */
' 190 epicsShareFunc long epicsShareAPI seq_pvChannelCount(SS_ID); /* returns number of channels */
' 191 epicsShareFunc long epicsShareAPI seq_pvConnectCount(SS_ID); /* returns number of channels conn'ed */
' 192 epicsShareFunc long epicsShareAPI seq_pvAssignCount(SS_ID); /* returns number of channels ass'ned */
' 193 epicsShareFunc long epicsShareAPI seq_pvCount(SS_ID, long); /* returns number of elements in arr */
' 194 epicsShareFunc void epicsShareAPI seq_pvFlush(); /* flush put/get requests */
' 195 epicsShareFunc long epicsShareAPI seq_pvIndex(SS_ID, long); /* returns index of pv */
2000-04-18 W. 196 epicsShareFunc long epicsShareAPI seq_seqLog(SS_ID, const char *, ...); /* Logging */
2000-04-14 Janet 197 epicsShareFunc void epicsShareAPI seq_delayInit(SS_ID, long, double);/* initialize a delay entry */
21:55:19 ' 198 epicsShareFunc long epicsShareAPI seq_delay(SS_ID, long); /* test a delay entry */
' 199 epicsShareFunc char *epicsShareAPI seq_macValueGet(SS_ID, char *); /* Given macro name, return ptr to val*/
' 200 epicsShareFunc long epicsShareAPI seq_optGet (SS_ID ssId, char *opt); /* check an option for TRUE/FALSE */
' 201
2001-03-22 Marty 202 epicsShareFunc long epicsShareAPI seqShow (epicsThreadId);
15:50:26 ' 203 epicsShareFunc long epicsShareAPI seqChanShow (epicsThreadId, char *);
2005-11-03 Andrew 204 epicsShareFunc long epicsShareAPI seqcar(int level);
2008-07-22 Andrew 205 epicsShareFunc void epicsShareAPI seqcaStats(int *pchans, int *pdiscon);
2001-03-22 Marty 206 epicsShareFunc long epicsShareAPI seqQueueShow (epicsThreadId tid);
15:50:26 ' 207 epicsShareFunc long epicsShareAPI seqStop (epicsThreadId);
' 208 epicsShareFunc void epicsShareAPI
' 209 seqRegisterSequencerProgram (struct seqProgram *p);
' 210 epicsShareFunc void epicsShareAPI seqRegisterSequencerCommands (void);
2001-03-22 Marty 211 epicsShareFunc epicsThreadId epicsShareAPI
19:23:24 ' 212 seq(struct seqProgram *, char *, unsigned int);
2004-04-05 Janet 213 epicsShareFunc struct state_program *epicsShareAPI seqFindProgByName (char *);
18:50:22 ' 214
2001-03-22 Marty 215
2001-02-16 W. 216 #ifdef __cplusplus
21:45:18 ' 217 } /* extern "C" */
' 218 #endif
2000-04-04 William 219
03:23:15 ' 220 #endif /*INCLseqComh*/