/* SNC Version 2.0.11: Fri May 27 10:07:33 2011: ../sncPau.stt */ /* Event flags */ #define ev_fcom_0 1 #define ev_fcom_1 2 #define ev_fcom_2 3 #define ev_fcom_3 4 #define ev_admin 5 /* Program "sncPau" */ #include "seqCom.h" #define NUM_SS 2 #define NUM_CHANNELS 11 #define NUM_EVENTS 5 #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 TRUE extern struct seqProgram sncPau; /* Variable declarations */ struct UserVar { int index; int feedback_mode; double offset[4]; double fcom[4]; double master; int admin; }; /* C code definitions */ # line 11 "../sncPau.stt" # line 12 "../sncPau.stt" #define ADMIN_OFF 0 # line 13 "../sncPau.stt" #define ADMIN_ON 1 # line 14 "../sncPau.stt" #define ADMIN_UNAVAILABLE 2 # line 15 "../sncPau.stt" #define FBCK_OFF 0 # line 16 "../sncPau.stt" #define FBCK_ON 1 # line 16 "../sncPau.stt" /* Entry handler */ static void entry_handler(SS_ID ssId, struct UserVar *pVar) { } /* Code for state "calc_bwProp" in state set "bwProp" */ /* Delay function for state "calc_bwProp" in state set "bwProp" */ static void D_bwProp_calc_bwProp(SS_ID ssId, struct UserVar *pVar) { # line 66 "../sncPau.stt" # line 73 "../sncPau.stt" # line 81 "../sncPau.stt" # line 88 "../sncPau.stt" } /* Event function for state "calc_bwProp" in state set "bwProp" */ static long E_bwProp_calc_bwProp(SS_ID ssId, struct UserVar *pVar, short *pTransNum, short *pNextState) { # line 66 "../sncPau.stt" if ((pVar->feedback_mode) && seq_efTestAndClear(ssId, ev_fcom_0)) { *pNextState = 0; *pTransNum = 0; return TRUE; } # line 73 "../sncPau.stt" if ((pVar->feedback_mode) && seq_efTestAndClear(ssId, ev_fcom_1)) { *pNextState = 0; *pTransNum = 1; return TRUE; } # line 81 "../sncPau.stt" if ((pVar->feedback_mode) && seq_efTestAndClear(ssId, ev_fcom_2)) { *pNextState = 0; *pTransNum = 2; return TRUE; } # line 88 "../sncPau.stt" if ((pVar->feedback_mode) && seq_efTestAndClear(ssId, ev_fcom_3)) { *pNextState = 0; *pTransNum = 3; return TRUE; } return FALSE; } /* Action function for state "calc_bwProp" in state set "bwProp" */ static void A_bwProp_calc_bwProp(SS_ID ssId, struct UserVar *pVar, short transNum) { switch(transNum) { case 0: { # line 62 "../sncPau.stt" (pVar->master) = (pVar->fcom)[0]; (pVar->offset)[0] = (pVar->fcom)[0] - (pVar->master); seq_pvPut(ssId, 1 /* offset */ + (0), 0); seq_pvPut(ssId, 9 /* master */, 0); } return; case 1: { # line 69 "../sncPau.stt" (pVar->master) = (pVar->fcom)[0]; (pVar->offset)[1] = (pVar->fcom)[1] - (pVar->master); seq_pvPut(ssId, 1 /* offset */ + (1), 0); seq_pvPut(ssId, 9 /* master */, 0); } return; case 2: { # line 77 "../sncPau.stt" (pVar->master) = (pVar->fcom)[0]; (pVar->offset)[2] = (pVar->fcom)[2] - (pVar->master); seq_pvPut(ssId, 1 /* offset */ + (2), 0); seq_pvPut(ssId, 9 /* master */, 0); } return; case 3: { # line 84 "../sncPau.stt" (pVar->master) = (pVar->fcom)[0]; (pVar->offset)[3] = (pVar->fcom)[3] - (pVar->master); seq_pvPut(ssId, 1 /* offset */ + (3), 0); seq_pvPut(ssId, 9 /* master */, 0); } return; } } /* Code for state "init" in state set "iocAdmin" */ /* Delay function for state "init" in state set "iocAdmin" */ static void D_iocAdmin_init(SS_ID ssId, struct UserVar *pVar) { # line 101 "../sncPau.stt" # line 104 "../sncPau.stt" } /* Event function for state "init" in state set "iocAdmin" */ static long E_iocAdmin_init(SS_ID ssId, struct UserVar *pVar, short *pTransNum, short *pNextState) { # line 101 "../sncPau.stt" if ((pVar->admin) == ADMIN_UNAVAILABLE) { *pNextState = 1; *pTransNum = 0; return TRUE; } # line 104 "../sncPau.stt" if (1) { *pNextState = 1; *pTransNum = 1; return TRUE; } return FALSE; } /* Action function for state "init" in state set "iocAdmin" */ static void A_iocAdmin_init(SS_ID ssId, struct UserVar *pVar, short transNum) { switch(transNum) { case 0: { # line 99 "../sncPau.stt" (pVar->admin) = ADMIN_OFF; seq_pvPut(ssId, 10 /* admin */, 0); } return; case 1: { } return; } } /* Code for state "check_mode" in state set "iocAdmin" */ /* Delay function for state "check_mode" in state set "iocAdmin" */ static void D_iocAdmin_check_mode(SS_ID ssId, struct UserVar *pVar) { # line 113 "../sncPau.stt" } /* Event function for state "check_mode" in state set "iocAdmin" */ static long E_iocAdmin_check_mode(SS_ID ssId, struct UserVar *pVar, short *pTransNum, short *pNextState) { # line 113 "../sncPau.stt" if (1) { *pNextState = 2; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "check_mode" in state set "iocAdmin" */ static void A_iocAdmin_check_mode(SS_ID ssId, struct UserVar *pVar, short transNum) { switch(transNum) { case 0: { # line 110 "../sncPau.stt" if ((pVar->admin) == ADMIN_OFF) { (pVar->feedback_mode) = FBCK_OFF; seq_pvPut(ssId, 0 /* feedback_mode */, 0); } # line 111 "../sncPau.stt" if ((pVar->admin) == ADMIN_ON) { (pVar->feedback_mode) = FBCK_ON; seq_pvPut(ssId, 0 /* feedback_mode */, 0); } # line 112 "../sncPau.stt" if ((pVar->admin) == ADMIN_UNAVAILABLE) { (pVar->feedback_mode) = FBCK_OFF; seq_pvPut(ssId, 0 /* feedback_mode */, 0); } } return; } } /* Code for state "wait_admin" in state set "iocAdmin" */ /* Delay function for state "wait_admin" in state set "iocAdmin" */ static void D_iocAdmin_wait_admin(SS_ID ssId, struct UserVar *pVar) { # line 119 "../sncPau.stt" } /* Event function for state "wait_admin" in state set "iocAdmin" */ static long E_iocAdmin_wait_admin(SS_ID ssId, struct UserVar *pVar, short *pTransNum, short *pNextState) { # line 119 "../sncPau.stt" if (seq_efTestAndClear(ssId, ev_admin)) { *pNextState = 1; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "wait_admin" in state set "iocAdmin" */ static void A_iocAdmin_wait_admin(SS_ID ssId, struct UserVar *pVar, short transNum) { switch(transNum) { case 0: { } return; } } /* Exit handler */ static void exit_handler(SS_ID ssId, struct UserVar *pVar) { } /************************ Tables ***********************/ /* Database Blocks */ static struct seqChan seqChan[NUM_CHANNELS] = { {"{MUX_NAME}:FBCK", (void *)OFFSET(struct UserVar, feedback_mode), "feedback_mode", "int", 1, 6, 0, 1, 0, 0, 0}, {"{MUX_NAME}:OFFSET_0", (void *)OFFSET(struct UserVar, offset[0]), "offset[0]", "double", 1, 7, 0, 0, 0, 0, 0}, {"{MUX_NAME}:OFFSET_1", (void *)OFFSET(struct UserVar, offset[1]), "offset[1]", "double", 1, 8, 0, 0, 0, 0, 0}, {"{MUX_NAME}:OFFSET_2", (void *)OFFSET(struct UserVar, offset[2]), "offset[2]", "double", 1, 9, 0, 0, 0, 0, 0}, {"{MUX_NAME}:OFFSET_3", (void *)OFFSET(struct UserVar, offset[3]), "offset[3]", "double", 1, 10, 0, 0, 0, 0, 0}, {"{MUX_NAME}:GETFCOM_0", (void *)OFFSET(struct UserVar, fcom[0]), "fcom[0]", "double", 1, 11, 1, 1, 0, 0, 0}, {"{MUX_NAME}:GETFCOM_1", (void *)OFFSET(struct UserVar, fcom[1]), "fcom[1]", "double", 1, 12, 2, 1, 0, 0, 0}, {"{MUX_NAME}:GETFCOM_2", (void *)OFFSET(struct UserVar, fcom[2]), "fcom[2]", "double", 1, 13, 3, 1, 0, 0, 0}, {"{MUX_NAME}:GETFCOM_3", (void *)OFFSET(struct UserVar, fcom[3]), "fcom[3]", "double", 1, 14, 4, 1, 0, 0, 0}, {"{MUX_NAME}", (void *)OFFSET(struct UserVar, master), "master", "double", 1, 15, 0, 0, 0, 0, 0}, {"{ADMIN_NAME}", (void *)OFFSET(struct UserVar, admin), "admin", "int", 1, 16, 5, 1, 0, 0, 0}, }; /* Event masks for state set bwProp */ /* Event mask for state calc_bwProp: */ static bitMask EM_bwProp_calc_bwProp[] = { 0x0000005e, }; /* State Blocks */ static struct seqState state_bwProp[] = { /* State "calc_bwProp" */ { /* state name */ "calc_bwProp", /* action function */ (ACTION_FUNC) A_bwProp_calc_bwProp, /* event function */ (EVENT_FUNC) E_bwProp_calc_bwProp, /* delay function */ (DELAY_FUNC) D_bwProp_calc_bwProp, /* entry function */ (ENTRY_FUNC) 0, /* exit function */ (EXIT_FUNC) 0, /* event mask array */ EM_bwProp_calc_bwProp, /* state options */ (0)}, }; /* Event masks for state set iocAdmin */ /* Event mask for state init: */ static bitMask EM_iocAdmin_init[] = { 0x00010000, }; /* Event mask for state check_mode: */ static bitMask EM_iocAdmin_check_mode[] = { 0x00000000, }; /* Event mask for state wait_admin: */ static bitMask EM_iocAdmin_wait_admin[] = { 0x00000020, }; /* State Blocks */ static struct seqState state_iocAdmin[] = { /* State "init" */ { /* state name */ "init", /* action function */ (ACTION_FUNC) A_iocAdmin_init, /* event function */ (EVENT_FUNC) E_iocAdmin_init, /* delay function */ (DELAY_FUNC) D_iocAdmin_init, /* entry function */ (ENTRY_FUNC) 0, /* exit function */ (EXIT_FUNC) 0, /* event mask array */ EM_iocAdmin_init, /* state options */ (0)}, /* State "check_mode" */ { /* state name */ "check_mode", /* action function */ (ACTION_FUNC) A_iocAdmin_check_mode, /* event function */ (EVENT_FUNC) E_iocAdmin_check_mode, /* delay function */ (DELAY_FUNC) D_iocAdmin_check_mode, /* entry function */ (ENTRY_FUNC) 0, /* exit function */ (EXIT_FUNC) 0, /* event mask array */ EM_iocAdmin_check_mode, /* state options */ (0)}, /* State "wait_admin" */ { /* state name */ "wait_admin", /* action function */ (ACTION_FUNC) A_iocAdmin_wait_admin, /* event function */ (EVENT_FUNC) E_iocAdmin_wait_admin, /* delay function */ (DELAY_FUNC) D_iocAdmin_wait_admin, /* entry function */ (ENTRY_FUNC) 0, /* exit function */ (EXIT_FUNC) 0, /* event mask array */ EM_iocAdmin_wait_admin, /* state options */ (0)}, }; /* State Set Blocks */ static struct seqSS seqSS[NUM_SS] = { /* State set "bwProp" */ { /* ss name */ "bwProp", /* ptr to state block */ state_bwProp, /* number of states */ 1, /* error state */ -1}, /* State set "iocAdmin" */ { /* ss name */ "iocAdmin", /* ptr to state block */ state_iocAdmin, /* number of states */ 3, /* error state */ -1}, }; /* Program parameter list */ static char prog_param[] = ""; /* State Program table (global) */ struct seqProgram sncPau = { /* magic number */ 20000315, /* *name */ "sncPau", /* *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_CONN | 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 sncPauRegistrar (void) { seqRegisterSequencerCommands(); seqRegisterSequencerProgram (&sncPau); } epicsExportRegistrar(sncPauRegistrar);