/* SNC Version 2.0.11: Sat Mar 20 16:04:59 2010: ../sncDSResync.stt */ /* Event flags */ /* Program "dsResync" */ #include "seqCom.h" #define NUM_SS 1 #define NUM_CHANNELS 30 #define NUM_EVENTS 0 #define NUM_QUEUES 0 #define MAX_STRING_SIZE 40 #define ASYNC_OPT FALSE #define CONN_OPT FALSE #define DEBUG_OPT FALSE #define MAIN_OPT FALSE #define NEWEF_OPT TRUE #define REENT_OPT TRUE extern struct seqProgram dsResync; /* Variable declarations */ struct UserVar { int reSyncDS1; int reSyncDS2; int reSyncDS3; int command_reSyncDS1[9]; int command_reSyncDS2[9]; int command_reSyncDS3[9]; int i; }; /* Entry handler */ static void entry_handler(SS_ID ssId, struct UserVar *pVar) { } /* Code for state "init" in state set "dsResync" */ /* Delay function for state "init" in state set "dsResync" */ static void D_dsResync_init(SS_ID ssId, struct UserVar *pVar) { # line 70 "../sncDSResync.stt" } /* Event function for state "init" in state set "dsResync" */ static long E_dsResync_init(SS_ID ssId, struct UserVar *pVar, short *pTransNum, short *pNextState) { # line 70 "../sncDSResync.stt" if (1) { *pNextState = 1; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "init" in state set "dsResync" */ static void A_dsResync_init(SS_ID ssId, struct UserVar *pVar, short transNum) { switch(transNum) { case 0: { } return; } } /* Code for state "resync" in state set "dsResync" */ /* Delay function for state "resync" in state set "dsResync" */ static void D_dsResync_resync(SS_ID ssId, struct UserVar *pVar) { # line 79 "../sncDSResync.stt" # line 85 "../sncDSResync.stt" # line 91 "../sncDSResync.stt" } /* Event function for state "resync" in state set "dsResync" */ static long E_dsResync_resync(SS_ID ssId, struct UserVar *pVar, short *pTransNum, short *pNextState) { # line 79 "../sncDSResync.stt" if ((pVar->reSyncDS1)) { *pNextState = 2; *pTransNum = 0; return TRUE; } # line 85 "../sncDSResync.stt" if ((pVar->reSyncDS2)) { *pNextState = 2; *pTransNum = 1; return TRUE; } # line 91 "../sncDSResync.stt" if ((pVar->reSyncDS3)) { *pNextState = 2; *pTransNum = 2; return TRUE; } return FALSE; } /* Action function for state "resync" in state set "dsResync" */ static void A_dsResync_resync(SS_ID ssId, struct UserVar *pVar, short transNum) { switch(transNum) { case 0: { # line 78 "../sncDSResync.stt" for ((pVar->i) = 0; (pVar->i) < 9; (pVar->i)++) { (pVar->command_reSyncDS1)[(pVar->i)] = 1; seq_pvPut(ssId, 3 /* command_reSyncDS1 */ + ((pVar->i)), 0); } } return; case 1: { # line 84 "../sncDSResync.stt" for ((pVar->i) = 0; (pVar->i) < 9; (pVar->i)++) { (pVar->command_reSyncDS2)[(pVar->i)] = 1; seq_pvPut(ssId, 12 /* command_reSyncDS2 */ + ((pVar->i)), 0); } } return; case 2: { # line 90 "../sncDSResync.stt" for ((pVar->i) = 0; (pVar->i) < 9; (pVar->i)++) { (pVar->command_reSyncDS3)[(pVar->i)] = 1; seq_pvPut(ssId, 21 /* command_reSyncDS3 */ + ((pVar->i)), 0); } } return; } } /* Code for state "release" in state set "dsResync" */ /* Delay function for state "release" in state set "dsResync" */ static void D_dsResync_release(SS_ID ssId, struct UserVar *pVar) { # line 98 "../sncDSResync.stt" # line 102 "../sncDSResync.stt" # line 106 "../sncDSResync.stt" } /* Event function for state "release" in state set "dsResync" */ static long E_dsResync_release(SS_ID ssId, struct UserVar *pVar, short *pTransNum, short *pNextState) { # line 98 "../sncDSResync.stt" if ((pVar->reSyncDS1) && wait(1.)) { *pNextState = 1; *pTransNum = 0; return TRUE; } # line 102 "../sncDSResync.stt" if ((pVar->reSyncDS2) && wait(1.)) { *pNextState = 1; *pTransNum = 1; return TRUE; } # line 106 "../sncDSResync.stt" if ((pVar->reSyncDS3) && wait(1.)) { *pNextState = 1; *pTransNum = 2; return TRUE; } return FALSE; } /* Action function for state "release" in state set "dsResync" */ static void A_dsResync_release(SS_ID ssId, struct UserVar *pVar, short transNum) { switch(transNum) { case 0: { # line 97 "../sncDSResync.stt" (pVar->reSyncDS1) = 0; # line 97 "../sncDSResync.stt" seq_pvPut(ssId, 0 /* reSyncDS1 */, 0); } return; case 1: { # line 101 "../sncDSResync.stt" (pVar->reSyncDS2) = 0; # line 101 "../sncDSResync.stt" seq_pvPut(ssId, 1 /* reSyncDS2 */, 0); } return; case 2: { # line 105 "../sncDSResync.stt" (pVar->reSyncDS3) = 0; # line 105 "../sncDSResync.stt" seq_pvPut(ssId, 2 /* reSyncDS3 */, 0); } return; } } /* Exit handler */ static void exit_handler(SS_ID ssId, struct UserVar *pVar) { } /************************ Tables ***********************/ /* Database Blocks */ static struct seqChan seqChan[NUM_CHANNELS] = { {"{PVNAME}_DS1", (void *)OFFSET(struct UserVar, reSyncDS1), "reSyncDS1", "int", 1, 1, 0, 1, 0, 0, 0}, {"{PVNAME}_DS2", (void *)OFFSET(struct UserVar, reSyncDS2), "reSyncDS2", "int", 1, 2, 0, 1, 0, 0, 0}, {"{PVNAME}_DS3", (void *)OFFSET(struct UserVar, reSyncDS3), "reSyncDS3", "int", 1, 3, 0, 1, 0, 0, 0}, {"GUN:IN20:1:GN1_RESYNC_DS1", (void *)OFFSET(struct UserVar, command_reSyncDS1[0]), "command_reSyncDS1[0]", "int", 1, 4, 0, 0, 0, 0, 0}, {"ACCL:IN20:300:L0A_RESYNC_DS1", (void *)OFFSET(struct UserVar, command_reSyncDS1[1]), "command_reSyncDS1[1]", "int", 1, 5, 0, 0, 0, 0, 0}, {"ACCL:IN20:400:L0B_RESYNC_DS1", (void *)OFFSET(struct UserVar, command_reSyncDS1[2]), "command_reSyncDS1[2]", "int", 1, 6, 0, 0, 0, 0, 0}, {"ACCL:LI21:1:L1S_RESYNC_DS1", (void *)OFFSET(struct UserVar, command_reSyncDS1[3]), "command_reSyncDS1[3]", "int", 1, 7, 0, 0, 0, 0, 0}, {"ACCL:LI21:180:L1X_RESYNC_DS1", (void *)OFFSET(struct UserVar, command_reSyncDS1[4]), "command_reSyncDS1[4]", "int", 1, 8, 0, 0, 0, 0, 0}, {"TCAV:IN20:490:TC0_RESYNC_DS1", (void *)OFFSET(struct UserVar, command_reSyncDS1[5]), "command_reSyncDS1[5]", "int", 1, 9, 0, 0, 0, 0, 0}, {"ACCL:LI24:L2:OFFSET_RESYNC_DS1", (void *)OFFSET(struct UserVar, command_reSyncDS1[6]), "command_reSyncDS1[6]", "int", 1, 10, 0, 0, 0, 0, 0}, {"ACCL:LI29:L3:OFFSET_RESYNC_DS1", (void *)OFFSET(struct UserVar, command_reSyncDS1[7]), "command_reSyncDS1[7]", "int", 1, 11, 0, 0, 0, 0, 0}, {"TCAV:LI24:800:TC3_RESYNC_DS1", (void *)OFFSET(struct UserVar, command_reSyncDS1[8]), "command_reSyncDS1[8]", "int", 1, 12, 0, 0, 0, 0, 0}, {"GUN:IN20:1:GN1_RESYNC_DS2", (void *)OFFSET(struct UserVar, command_reSyncDS2[0]), "command_reSyncDS2[0]", "int", 1, 13, 0, 0, 0, 0, 0}, {"ACCL:IN20:300:L0A_RESYNC_DS2", (void *)OFFSET(struct UserVar, command_reSyncDS2[1]), "command_reSyncDS2[1]", "int", 1, 14, 0, 0, 0, 0, 0}, {"ACCL:IN20:400:L0B_RESYNC_DS2", (void *)OFFSET(struct UserVar, command_reSyncDS2[2]), "command_reSyncDS2[2]", "int", 1, 15, 0, 0, 0, 0, 0}, {"ACCL:LI21:1:L1S_RESYNC_DS2", (void *)OFFSET(struct UserVar, command_reSyncDS2[3]), "command_reSyncDS2[3]", "int", 1, 16, 0, 0, 0, 0, 0}, {"ACCL:LI21:180:L1X_RESYNC_DS2", (void *)OFFSET(struct UserVar, command_reSyncDS2[4]), "command_reSyncDS2[4]", "int", 1, 17, 0, 0, 0, 0, 0}, {"TCAV:IN20:490:TC0_RESYNC_DS2", (void *)OFFSET(struct UserVar, command_reSyncDS2[5]), "command_reSyncDS2[5]", "int", 1, 18, 0, 0, 0, 0, 0}, {"ACCL:LI24:L2:OFFSET_RESYNC_DS2", (void *)OFFSET(struct UserVar, command_reSyncDS2[6]), "command_reSyncDS2[6]", "int", 1, 19, 0, 0, 0, 0, 0}, {"ACCL:LI29:L3:OFFSET_RESYNC_DS2", (void *)OFFSET(struct UserVar, command_reSyncDS2[7]), "command_reSyncDS2[7]", "int", 1, 20, 0, 0, 0, 0, 0}, {"TCAV:LI24:800:TC3_RESYNC_DS2", (void *)OFFSET(struct UserVar, command_reSyncDS2[8]), "command_reSyncDS2[8]", "int", 1, 21, 0, 0, 0, 0, 0}, {"GUN:IN20:1:GN1_RESYNC_DS3", (void *)OFFSET(struct UserVar, command_reSyncDS3[0]), "command_reSyncDS3[0]", "int", 1, 22, 0, 0, 0, 0, 0}, {"ACCL:IN20:300:L0A_RESYNC_DS3", (void *)OFFSET(struct UserVar, command_reSyncDS3[1]), "command_reSyncDS3[1]", "int", 1, 23, 0, 0, 0, 0, 0}, {"ACCL:IN20:400:L0B_RESYNC_DS3", (void *)OFFSET(struct UserVar, command_reSyncDS3[2]), "command_reSyncDS3[2]", "int", 1, 24, 0, 0, 0, 0, 0}, {"ACCL:LI21:1:L1S_RESYNC_DS3", (void *)OFFSET(struct UserVar, command_reSyncDS3[3]), "command_reSyncDS3[3]", "int", 1, 25, 0, 0, 0, 0, 0}, {"ACCL:LI21:180:L1X_RESYNC_DS3", (void *)OFFSET(struct UserVar, command_reSyncDS3[4]), "command_reSyncDS3[4]", "int", 1, 26, 0, 0, 0, 0, 0}, {"TCAV:IN20:490:TC0_RESYNC_DS3", (void *)OFFSET(struct UserVar, command_reSyncDS3[5]), "command_reSyncDS3[5]", "int", 1, 27, 0, 0, 0, 0, 0}, {"ACCL:LI24:L2:OFFSET_RESYNC_DS3", (void *)OFFSET(struct UserVar, command_reSyncDS3[6]), "command_reSyncDS3[6]", "int", 1, 28, 0, 0, 0, 0, 0}, {"ACCL:LI29:L3:OFFSET_RESYNC_DS3", (void *)OFFSET(struct UserVar, command_reSyncDS3[7]), "command_reSyncDS3[7]", "int", 1, 29, 0, 0, 0, 0, 0}, {"TCAV:LI24:800:TC3_RESYNC_DS3", (void *)OFFSET(struct UserVar, command_reSyncDS3[8]), "command_reSyncDS3[8]", "int", 1, 30, 0, 0, 0, 0, 0}, }; /* Event masks for state set dsResync */ /* Event mask for state init: */ static bitMask EM_dsResync_init[] = { 0x00000000, }; /* Event mask for state resync: */ static bitMask EM_dsResync_resync[] = { 0x0000000e, }; /* Event mask for state release: */ static bitMask EM_dsResync_release[] = { 0x0000000e, }; /* State Blocks */ static struct seqState state_dsResync[] = { /* State "init" */ { /* state name */ "init", /* action function */ (ACTION_FUNC) A_dsResync_init, /* event function */ (EVENT_FUNC) E_dsResync_init, /* delay function */ (DELAY_FUNC) D_dsResync_init, /* entry function */ (ENTRY_FUNC) 0, /* exit function */ (EXIT_FUNC) 0, /* event mask array */ EM_dsResync_init, /* state options */ (0)}, /* State "resync" */ { /* state name */ "resync", /* action function */ (ACTION_FUNC) A_dsResync_resync, /* event function */ (EVENT_FUNC) E_dsResync_resync, /* delay function */ (DELAY_FUNC) D_dsResync_resync, /* entry function */ (ENTRY_FUNC) 0, /* exit function */ (EXIT_FUNC) 0, /* event mask array */ EM_dsResync_resync, /* state options */ (0)}, /* State "release" */ { /* state name */ "release", /* action function */ (ACTION_FUNC) A_dsResync_release, /* event function */ (EVENT_FUNC) E_dsResync_release, /* delay function */ (DELAY_FUNC) D_dsResync_release, /* entry function */ (ENTRY_FUNC) 0, /* exit function */ (EXIT_FUNC) 0, /* event mask array */ EM_dsResync_release, /* state options */ (0)}, }; /* State Set Blocks */ static struct seqSS seqSS[NUM_SS] = { /* State set "dsResync" */ { /* ss name */ "dsResync", /* ptr to state block */ state_dsResync, /* number of states */ 3, /* error state */ -1}, }; /* Program parameter list */ static char prog_param[] = ""; /* State Program table (global) */ struct seqProgram dsResync = { /* magic number */ 20000315, /* *name */ "dsResync", /* *pChannels */ seqChan, /* numChans */ NUM_CHANNELS, /* *pSS */ seqSS, /* numSS */ NUM_SS, /* user variable size */ sizeof(struct UserVar), /* *pParams */ prog_param, /* numEvents */ NUM_EVENTS, /* encoded options */ (0 | OPT_NEWEF | OPT_REENT), /* entry handler */ (ENTRY_FUNC) entry_handler, /* exit handler */ (EXIT_FUNC) exit_handler, /* numQueues */ NUM_QUEUES, }; /* Register sequencer commands and program */ void dsResyncRegistrar (void) { seqRegisterSequencerCommands(); seqRegisterSequencerProgram (&dsResync); } epicsExportRegistrar(dsResyncRegistrar);