Title / Description
Code int main(int Parm_Count, char *Parms[]) { int Quit = 0, i; dsp_struct dsp; char input_buffer[MAX_LINE_LENGTH]; // Setup structure (to be saved to a file) memset(&dsp, 0, sizeof(dsp_struct)); dsp.last_menu = 2; dsp.last_device = 0; // control FPGA regs dsp.last_board = 0; // master hub dsp.last_fpga = 0; strcpy(dsp.hostName, "192.168.3.3"); strcpy(dsp.last_filename[0], "dsp_control.bit"); for(i=1;i<5;i++) { strcpy(dsp.last_filename[i], "beamformer.bit"); } // Reset event gen stats memset(&eg, 0, sizeof(event_struct)); // Ask about connection type printf("Connect using USB/Ethernet [E] :>"); fgets_lc(input_buffer, MAX_LINE_LENGTH, stdin); if (input_buffer[0] == 'u') { dsp.comms.type = TYPE_USB; } else { dsp.comms.type = TYPE_ETHERNET; // Ask about Eth connection name printf("Connect to which shelf? [%s] :>", dsp.hostName); fgets_lc(input_buffer, MAX_LINE_LENGTH, stdin); if (input_buffer[0] != '\n') { input_buffer[strlen(input_buffer)-1] = 0; // Strip out trailing newline strcpy(dsp.hostName, input_buffer); } } // Open the Card if (control_open(&dsp.comms, dsp.hostName) < 0) { printf("Ethernet connect failed\n"); goto Exit; } if (control_read_register(&dsp.comms, MASTER_HUB_CARD, CONTROL_REGS, DSP_CTRL_SYS_GOODBEEF) != 0x900dbeef) { printf("Master hub card magic ERROR\n"); goto Exit; } // Ask about startup (setup temp and voltage monitoring on the dsp and rtm) printf("Execute DSP hub card startup? [y] :>"); fgets_lc(input_buffer, MAX_LINE_LENGTH, stdin); if (input_buffer[0] == 'y' || input_buffer[0] == '\n') { dsp_init(&dsp, MASTER_HUB_CARD); printf("Startup sequence complete\n"); while(!kbhit()); } //Main processing loop Quit = 0; do { //Display the initial menu dsp.last_menu = displayMainMenu(&dsp); //Handle menu options switch(dsp.last_menu) { case 1: do_program_fpga(&dsp); break; case 2: do_view_dsp_card(&dsp); break; case 3: do_dsp_program(&dsp); break; case 8: do_set_DSPIP(&dsp); break; case 9: do_RTM_clkcond_setup(&dsp); break; case 10: do_program_spi(&dsp); break; case 11: do_capture_bat(&dsp); break; case 16: do_PatrnGenRAMInit(&dsp); break; case 17: do_crosspoint_ber_setup(&dsp); break; case 18: do_sandwich_test(&dsp); break; case 20: do_PatrnChkRAMInit(&dsp); break; case 21: do_interactive_debug(&dsp); break; case 22: // Exit the test program Quit = 1; break; default: // On invalid input generate an error printf("Selection Unhandled:%d\n", dsp.last_menu);} } while(Quit != 1); // Loop until a quit message is signaled by the user Exit: control_close(&dsp.comms); return 0; }
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code