/* Generated with snc from ../trgDetector.stt */ /* Program "trgDetector" */ #include #include #include #include #include "epicsTypes.h" #include "seqCom.h" /* Variable declarations */ struct UserVar { # line 6 "../trgDetector.stt" long intCnt; # line 13 "../trgDetector.stt" int trgStatus; }; /* Program init func */ static void G_prog_init(struct UserVar *pVar) { static struct UserVar pVarInit = { 0, 0, }; *pVar = pVarInit; } /****** Code for state "normal" in state set "trgDetector" ******/ /* Entry function for state "normal" in state set "trgDetector" */ static void I_trgDetector_normal(SS_ID ssId, struct UserVar *pVar) { # line 23 "../trgDetector.stt" pVar->trgStatus = 0; # line 24 "../trgDetector.stt" seq_pvPut(ssId, 1/*trgStatus*/, 0); } /* Delay function for state "normal" in state set "trgDetector" */ static void D_trgDetector_normal(SS_ID ssId, struct UserVar *pVar) { # line 31 "../trgDetector.stt" seq_delayInit(ssId, 0, (2.)); } /* Event function for state "normal" in state set "trgDetector" */ static seqBool E_trgDetector_normal(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 27 "../trgDetector.stt" if (seq_efTestAndClear(ssId, 1/*ev_intCnt*/)) { *pNextState = 0; *pTransNum = 0; return TRUE; } # line 31 "../trgDetector.stt" if (seq_delay(ssId, 0)) { *pNextState = 1; *pTransNum = 1; return TRUE; } return FALSE; } /* Action function for state "normal" in state set "trgDetector" */ static void A_trgDetector_normal(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { } return; case 1: { } return; } } /****** Code for state "distrupt" in state set "trgDetector" ******/ /* Entry function for state "distrupt" in state set "trgDetector" */ static void I_trgDetector_distrupt(SS_ID ssId, struct UserVar *pVar) { # line 41 "../trgDetector.stt" pVar->trgStatus = 1; # line 42 "../trgDetector.stt" seq_pvPut(ssId, 1/*trgStatus*/, 0); } /* Delay function for state "distrupt" in state set "trgDetector" */ static void D_trgDetector_distrupt(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "distrupt" in state set "trgDetector" */ static seqBool E_trgDetector_distrupt(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 45 "../trgDetector.stt" if (seq_efTestAndClear(ssId, 1/*ev_intCnt*/)) { *pNextState = 0; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "distrupt" in state set "trgDetector" */ static void A_trgDetector_distrupt(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { } return; } } /************************ Tables ************************/ /* Channel table */ static seqChan G_channels[] = { /* chName, offset, varName, varType, count, eventNum, efId, monitored, queueSize, queueIndex */ #if LONG_MAX > 0x7fffffffL # line 6 "../trgDetector.stt" #error variable 'long intCnt' cannot be assigned to a PV (on the chosen target system)\ because Channel Access does not support integral types longer than 4 bytes.\ You can use 'int' instead, or the fixed size type 'int32_t'. #endif {"{PRIM}:{LOCA}:{UNIT}:{PAD}_NUM_INTR", offsetof(struct UserVar, intCnt), "intCnt", "long", 1, 2, 1, 1, 0, 0}, {"{PRIM}:{LOCA}:{UNIT}:{PAD}_TRG_ST", offsetof(struct UserVar, trgStatus), "trgStatus", "int", 1, 3, 0, 0, 0, 0} }; /* Event masks for state set "trgDetector" */ static const seqMask EM_trgDetector_normal[] = { 0x00000002, }; static const seqMask EM_trgDetector_distrupt[] = { 0x00000002, }; /* State table for state set "trgDetector" */ static seqState G_trgDetector_states[] = { { /* state name */ "normal", /* action function */ A_trgDetector_normal, /* event function */ E_trgDetector_normal, /* delay function */ D_trgDetector_normal, /* entry function */ I_trgDetector_normal, /* exit function */ 0, /* event mask array */ EM_trgDetector_normal, /* state options */ (0) }, { /* state name */ "distrupt", /* action function */ A_trgDetector_distrupt, /* event function */ E_trgDetector_distrupt, /* delay function */ D_trgDetector_distrupt, /* entry function */ I_trgDetector_distrupt, /* exit function */ 0, /* event mask array */ EM_trgDetector_distrupt, /* state options */ (0) }, }; /* State set table */ static seqSS G_state_sets[] = { { /* state set name */ "trgDetector", /* states */ G_trgDetector_states, /* number of states */ 2, /* number of delays */ 1 }, }; /* Program table (global) */ seqProgram trgDetector = { /* magic number */ 2001006, /* program name */ "trgDetector", /* channels */ G_channels, /* num. channels */ 2, /* state sets */ G_state_sets, /* num. state sets */ 1, /* user var size */ sizeof(struct UserVar), /* param */ "", /* num. event flags */ 1, /* encoded options */ (0 | OPT_CONN | OPT_NEWEF | OPT_REENT), /* init func */ G_prog_init, /* entry func */ NULL, /* exit func */ NULL, /* num. queues */ 0 }; /* Register sequencer commands and program */ #include "epicsExport.h" static void trgDetectorRegistrar (void) { seqRegisterSequencerCommands(); seqRegisterSequencerProgram (&trgDetector); } epicsExportRegistrar(trgDetectorRegistrar);