/* SNC Version 2.0.11: Fri Oct 26 15:42:45 2007: ../sncpllAutoAcquire.stt */ /* Event flags */ /* Program "PLLAutoAcquire" */ #include "seqCom.h" #define NUM_SS 1 #define NUM_CHANNELS 3 #define NUM_EVENTS 0 #define NUM_QUEUES 0 #define MAX_STRING_SIZE 40 #define ASYNC_OPT FALSE #define CONN_OPT TRUE #define DEBUG_OPT FALSE #define MAIN_OPT FALSE #define NEWEF_OPT TRUE #define REENT_OPT FALSE extern struct seqProgram PLLAutoAcquire; /* Variable declarations */ static int autoAcquire; static int refreshWaveform; static int index; /* Not used (avoids compilation warnings) */ struct UserVar { int dummy; }; /* C code definitions */ # line 12 "../sncpllAutoAcquire.stt" # line 13 "../sncpllAutoAcquire.stt" #include # line 14 "../sncpllAutoAcquire.stt" #define STOP 0 # line 15 "../sncpllAutoAcquire.stt" #define START 1 # line 16 "../sncpllAutoAcquire.stt" #define UPDATETIME 30. # line 17 "../sncpllAutoAcquire.stt" #define UPDATEINTERVAL 1. # line 18 "../sncpllAutoAcquire.stt" #define UPDATEREPEAT 50 # line 19 "../sncpllAutoAcquire.stt" #define DISABLE 0 # line 20 "../sncpllAutoAcquire.stt" #define ENABLE 1 # line 20 "../sncpllAutoAcquire.stt" /* Entry handler */ static void entry_handler(SS_ID ssId, struct UserVar *pVar) { } /* Code for state "stopAcquire" in state set "autoAcquire" */ /* Delay function for state "stopAcquire" in state set "autoAcquire" */ static void D_autoAcquire_stopAcquire(SS_ID ssId, struct UserVar *pVar) { # line 40 "../sncpllAutoAcquire.stt" } /* Event function for state "stopAcquire" in state set "autoAcquire" */ static long E_autoAcquire_stopAcquire(SS_ID ssId, struct UserVar *pVar, short *pTransNum, short *pNextState) { # line 40 "../sncpllAutoAcquire.stt" if (autoAcquire) { *pNextState = 1; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "stopAcquire" in state set "autoAcquire" */ static void A_autoAcquire_stopAcquire(SS_ID ssId, struct UserVar *pVar, short transNum) { switch(transNum) { case 0: { # line 38 "../sncpllAutoAcquire.stt" index = 0; seq_pvPut(ssId, 2 /* index */, 0); } return; } } /* Code for state "startAcquire" in state set "autoAcquire" */ /* Delay function for state "startAcquire" in state set "autoAcquire" */ static void D_autoAcquire_startAcquire(SS_ID ssId, struct UserVar *pVar) { # line 48 "../sncpllAutoAcquire.stt" # line 51 "../sncpllAutoAcquire.stt" seq_delayInit(ssId, 0, (UPDATEINTERVAL)); } /* Event function for state "startAcquire" in state set "autoAcquire" */ static long E_autoAcquire_startAcquire(SS_ID ssId, struct UserVar *pVar, short *pTransNum, short *pNextState) { # line 48 "../sncpllAutoAcquire.stt" if (!autoAcquire) { *pNextState = 0; *pTransNum = 0; return TRUE; } # line 51 "../sncpllAutoAcquire.stt" if (seq_delay(ssId, 0)) { *pNextState = 2; *pTransNum = 1; return TRUE; } return FALSE; } /* Action function for state "startAcquire" in state set "autoAcquire" */ static void A_autoAcquire_startAcquire(SS_ID ssId, struct UserVar *pVar, short transNum) { switch(transNum) { case 0: { # line 46 "../sncpllAutoAcquire.stt" index = 0; seq_pvPut(ssId, 2 /* index */, 0); } return; case 1: { } return; } } /* Code for state "stAcquire" in state set "autoAcquire" */ /* Delay function for state "stAcquire" in state set "autoAcquire" */ static void D_autoAcquire_stAcquire(SS_ID ssId, struct UserVar *pVar) { # line 59 "../sncpllAutoAcquire.stt" # line 66 "../sncpllAutoAcquire.stt" } /* Event function for state "stAcquire" in state set "autoAcquire" */ static long E_autoAcquire_stAcquire(SS_ID ssId, struct UserVar *pVar, short *pTransNum, short *pNextState) { # line 59 "../sncpllAutoAcquire.stt" if (index > UPDATEREPEAT) { *pNextState = 0; *pTransNum = 0; return TRUE; } # line 66 "../sncpllAutoAcquire.stt" if (index <= UPDATEREPEAT) { *pNextState = 1; *pTransNum = 1; return TRUE; } return FALSE; } /* Action function for state "stAcquire" in state set "autoAcquire" */ static void A_autoAcquire_stAcquire(SS_ID ssId, struct UserVar *pVar, short transNum) { switch(transNum) { case 0: { # line 57 "../sncpllAutoAcquire.stt" autoAcquire = STOP; seq_pvPut(ssId, 0 /* autoAcquire */, 0); } return; case 1: { # line 62 "../sncpllAutoAcquire.stt" index++; seq_pvPut(ssId, 2 /* index */, 0); refreshWaveform = ENABLE; seq_pvPut(ssId, 1 /* refreshWaveform */, 0); } return; } } /* Exit handler */ static void exit_handler(SS_ID ssId, struct UserVar *pVar) { } /************************ Tables ***********************/ /* Database Blocks */ static struct seqChan seqChan[NUM_CHANNELS] = { {"{AUTO_ACQUIRE}", (void *)&autoAcquire, "autoAcquire", "int", 1, 1, 0, 1, 0, 0, 0}, {"{REFRESH_WAVEFORM}", (void *)&refreshWaveform, "refreshWaveform", "int", 1, 2, 0, 1, 0, 0, 0}, {"{AUTO_ACQUIRE_INDEX}", (void *)&index, "index", "int", 1, 3, 0, 0, 0, 0, 0}, }; /* Event masks for state set autoAcquire */ /* Event mask for state stopAcquire: */ static bitMask EM_autoAcquire_stopAcquire[] = { 0x00000002, }; /* Event mask for state startAcquire: */ static bitMask EM_autoAcquire_startAcquire[] = { 0x00000002, }; /* Event mask for state stAcquire: */ static bitMask EM_autoAcquire_stAcquire[] = { 0x00000008, }; /* State Blocks */ static struct seqState state_autoAcquire[] = { /* State "stopAcquire" */ { /* state name */ "stopAcquire", /* action function */ (ACTION_FUNC) A_autoAcquire_stopAcquire, /* event function */ (EVENT_FUNC) E_autoAcquire_stopAcquire, /* delay function */ (DELAY_FUNC) D_autoAcquire_stopAcquire, /* entry function */ (ENTRY_FUNC) 0, /* exit function */ (EXIT_FUNC) 0, /* event mask array */ EM_autoAcquire_stopAcquire, /* state options */ (0)}, /* State "startAcquire" */ { /* state name */ "startAcquire", /* action function */ (ACTION_FUNC) A_autoAcquire_startAcquire, /* event function */ (EVENT_FUNC) E_autoAcquire_startAcquire, /* delay function */ (DELAY_FUNC) D_autoAcquire_startAcquire, /* entry function */ (ENTRY_FUNC) 0, /* exit function */ (EXIT_FUNC) 0, /* event mask array */ EM_autoAcquire_startAcquire, /* state options */ (0)}, /* State "stAcquire" */ { /* state name */ "stAcquire", /* action function */ (ACTION_FUNC) A_autoAcquire_stAcquire, /* event function */ (EVENT_FUNC) E_autoAcquire_stAcquire, /* delay function */ (DELAY_FUNC) D_autoAcquire_stAcquire, /* entry function */ (ENTRY_FUNC) 0, /* exit function */ (EXIT_FUNC) 0, /* event mask array */ EM_autoAcquire_stAcquire, /* state options */ (0)}, }; /* State Set Blocks */ static struct seqSS seqSS[NUM_SS] = { /* State set "autoAcquire" */ { /* ss name */ "autoAcquire", /* ptr to state block */ state_autoAcquire, /* number of states */ 3, /* error state */ -1}, }; /* Program parameter list */ static char prog_param[] = ""; /* State Program table (global) */ struct seqProgram PLLAutoAcquire = { /* magic number */ 20000315, /* *name */ "PLLAutoAcquire", /* *pChannels */ seqChan, /* numChans */ NUM_CHANNELS, /* *pSS */ seqSS, /* numSS */ NUM_SS, /* user variable size */ 0, /* *pParams */ prog_param, /* numEvents */ NUM_EVENTS, /* encoded options */ (0 | OPT_CONN | OPT_NEWEF), /* entry handler */ (ENTRY_FUNC) entry_handler, /* exit handler */ (EXIT_FUNC) exit_handler, /* numQueues */ NUM_QUEUES, }; /* Register sequencer commands and program */ void PLLAutoAcquireRegistrar (void) { seqRegisterSequencerCommands(); seqRegisterSequencerProgram (&PLLAutoAcquire); } epicsExportRegistrar(PLLAutoAcquireRegistrar);