/************************************************************************** ** ** main.c - illustrate various clocking method of aladin array ** need by the IRTF controllers. Corresponds to ~/common/cli_comlist.c ** *************************************************************************** */ #define EXTERN #define MAIN 1 /*-------------------------- ** include files **-------------------------- */ #include #include #include #include #include #include #include #include "common.h" #include "ce.h" #include "ircommand.h" #include "ir.h" #include "al.h" /*-------------------------------- ** function prototype **-------------------------------- */ int main( int argc, char * argv[]); int cmd_execute( char * cmd_buf ); int myarg_parse( int * argc, char ** argv , char * bufin); int myarg_print( int argc, char * argv[] ); int help_app( int argc, char * argv[] ); int itime_app( int argc, char * argv[]); int quit_app( int argc, char * argv[] ); int p1_app( int argc, char * argv[] ); /*-------------------------------- ** static variable to main.c **-------------------------------- */ /* types and data to support cmd_execute() */ struct parse_table_t { char * kw; /* The opcode string */ int (* pfi)( int argc, char * argv[]); /* pfi is pointer it function */ char * desc; /* Description of command */ }; struct parse_table_t Parse_table[] = { /* host commands */ { "help", help_app, " Help - list the commands."}, { "h", help_app, " Help - list the commands."}, { "itime", itime_app, " itime sec - set itime time in sec."}, { "quit", quit_app, " Quit - quits the application." }, { "p1", p1_app, " p1 - pclock test command 1."}, /* ---------- SGIR controller commands - ir options -------------*/ { "acqmode", acqmode_app, " acqumode { basic | movie } ."}, { "bgr.go", bgr_go, " bgr.go - does a BGR, resets array."}, { "bgr.wait.ms", bgr_wait_ms, " bgr.wait.ms ms - wait between BGR and GO"}, { "cbmode", cbmode_app, " cbmode: { fs | fd | ramp } "}, { "coadd", coadd_app, " coadd - set the number of coadds."}, { "darray", darray_app, " darray I X Y W H - dimension of darray[i]."}, { "irinit", irinit_app, " irinit { al | h2 } - Set device and init (LINUX ONLY)."}, { "itime_msec", itime_msec_app, " itime_msec msec - set itime in msec."}, { "ndr", ndr_app, " ndr N - set non destructive read."}, { "numdarray", num_darray_app, " numdarray N - number of data arrays for readout."}, { "rsample", rsample_app, " rsample N - up-the-ramp samples."}, { "slowcnt", slowcnt_app, " slowcnt N - sets the clocking's timeslice period."}, /* ---------- SGIR controller commands - aladdin options -------*/ { "al.bgr.usec", al_bgr_usec_app, " al.bgr.usec - sets Background Reset Period."}, { "al.glr.usec", al_glr_usec_app, " al.glr.usec - sets Global Reset Period."}, /* ---------- SGIR controller commands - h2rg options ----------*/ { "h2rg.init", h2rg_init_app, " h2rg.init - does basic initialization for H2RG operations."}, { "h2rg.cksub", h2rg_check_subarray_app, " h2rg.cksub - checks subarray parameters."}, { "h2rg.bgrclk", h2rg_bgrclock_app," h2rg.bgrclk - ."}, { "h2rg.bgren", h2rg_bgren_app, " h2rg.bgren - ."}, { "h2rg.bgrrst", h2rg_bgrrest_app," h2rg.bgrrst - ."}, { "h2rg.bgrwait", h2rg_bgrwait_app," h2rg.bgrwait - ."}, { "h2rg.itime", h2rg_itime_app, " h2rg.itime - ."}, { "h2rg.rdr", h2rg_rdr_app, " h2rg.rdr - ."}, { "h2rg.rom", h2rg_rom_app, " h2rg.rom - ."}, { "h2rg.rren", h2rg_rren_app, " h2rg.rren - ."}, { "h2rg.setrstm", h2rg_setrstm_app," h2rg.setrstm - ."}, { "h2rg.setttf", h2rg_setttf_app, " h2rg.setttf - ."}, { "h2rg.setttl", h2rg_setttl_app, " h2rg.setttl - ."}, { "h2rg.setvrd", h2rg_setvrd_app, " h2rg.setvrd - ."}, { "h2rg.setwd", h2rg_setwd_app, " h2rg.setwd - ."}, { "h2rg.slowcnt", h2rg_slowcnt_app," h2rg.slowcnt - ."}, { "h2rg.surwt", h2rg_surwt_app, " h2rg.surwt - ."}, { "h2rge.suram", h2rge_suram_app, " h2rge.suram - ."}, { "h2rge.setreg", h2rge_setreg_app," h2rge.setreg - ."}, { "h2rge.setemd", h2rge_setemd_app," h2rge.setemd - ."}, { "h2rge.setspr", h2rge_setspr_app," h2rge.setspr - ."}, { "h2rge.selsp", h2rge_selsp_app, " h2rge.selsp - ."}, { "h2rge.selsl", h2rge_selsl_app, " h2rge.selsl - ."}, { "h2rge.vbg", h2rge_vbg_app, " h2rge.vbg - ."}, { "h2rge.vds", h2rge_vds_app, " h2rge.vds - ."}, { "h2rge.vrst", h2rge_vrst_app, " h2rge.vrst - ."}, { "h2rge.psswd", h2rge_psswd_app, " h2rge.passd - ."}, /* ---------- SGIR controller commands - h2rg peak and poke ----------*/ { "pnp.sh_open", pnp_shutter_open_app, " pnp.sh_open - open the shutter"}, { "pnp.sh_close", pnp_shutter_close_app," pnp.sh_close - close the shutter"}, { "pnp.f_run", pnp_fifo_run_app, " pnp.f_run - start the fifo"}, { "pnp.f_stop", pnp_fifo_stop_app," pnp.f_stop - stop the fifo"}, { "pnp.digio", pnp_digio_app, " pnp.digio - set value to digio"}, { "pnp.set_ppg4", pnp_ppg4_app, " pnp.set_ppg4 - set a value for the PPG4 (same for all ts)"}, { "pnp.run_ppg4", pnp_ppg4_run_app, " pnp.run_ppg4 - run the PPG4"}, { "pnp.set_spg4", pnp_spg4_app, " pnp.set_spg4 - set a value for the SPG4 (same for all ts)"}, { "pnp.set_spg3", pnp_spg3_app, " pnp.set_spg3 - set a value for the SPG3 (same for all ts)"}, { "pnp.run_spg", pnp_spg_run_app, " pnp.run_spg - run the SPG"}, /* ---------- SGIR controller commands - GO -------------------*/ { "go", go_app, " go - acquire images."}, { "show", show_app, " show - show HOST & GLOBAL DATA."}, /* ---------- SGIR controller - test commands -------------------*/ { "t1", t1_app, " t1 - test command 1."}, { "t2", t2_app, " t2 - test command 2."}, { "t3", t3_app, " t3 - test command 3."}, { "t4", t4_app, " t4 - test command 4."}, { "t5", t5_app, " t5 - test command 5."}, { "t9", t5_app, " t5 - test command 5."}, }; int Num_parse_item = { sizeof(Parse_table) / sizeof(struct parse_table_t) }; /*--------------------------------- ** main() **--------------------------------- */ int main( int argc, char * argv[]) { char buf[80]; ircommand_initial_setup( IRDEVICE_H2 ); /* boot time setup for ircommand */ help_app( 0, NULL ); while( 1 ) { /* Get command */ printf("\n"); printf("Enter Command: "); fgets( buf, sizeof(buf), stdin ); str_rws( buf, sizeof(buf)); cmd_execute( buf ); } return 0; } /*------------------------------------------------------------- ** cmd_execute() - Executes a command line instruction **------------------------------------------------------------- */ int cmd_execute( char * cmd_buf /* I: command to execute */ ) { int rc, found, i; int argc; char ** argv; //printf("cmd_execute( %s )\n", cmd_buf); argv = cli_argv( &argc, cmd_buf); /* exit on blank line or comments */ if( (argc == 0) || (*argv[0] == '#') ) return( 0 ); /* ** Search table for keyword. If found call function. */ rc = FAIL; for(i=0, found = FALSE; i