diff options
author | Michael J. Chudobiak <mjc@avtechpulse.com> | 2012-10-11 15:16:33 -0400 |
---|---|---|
committer | Michael J. Chudobiak <mjc@avtechpulse.com> | 2012-10-11 15:16:33 -0400 |
commit | 74b9ff28228e3858ef4bc181a34a9acf9ca6be79 (patch) | |
tree | 97d86198073500ef287f8298d6f8df713773d037 | |
parent | 9f693eba66b3ff9934050fd4b5c50b7660cc3096 (diff) |
remove unused stopbit and echo settings
-rw-r--r-- | device-functions.c | 33 | ||||
-rw-r--r-- | device-functions.h | 2 | ||||
-rw-r--r-- | flash.c | 4 | ||||
-rw-r--r-- | globals.h | 4 | ||||
-rw-r--r-- | gpib.c | 12 | ||||
-rw-r--r-- | instr-daemon.c | 2 | ||||
-rw-r--r-- | menus.c | 108 | ||||
-rw-r--r-- | parser.c | 78 |
8 files changed, 48 insertions, 195 deletions
diff --git a/device-functions.c b/device-functions.c index 4753b28..8812cfa 100644 --- a/device-functions.c +++ b/device-functions.c @@ -4622,17 +4622,8 @@ void Main_update_shift_registers() } -int IO_Setup_RS232(int baud, char stopbits, char hardhand, char echo, gboolean update_flash) +int IO_Setup_RS232(int baud, char hardhand, gboolean update_flash) { - // debugging - printf ("baud: %d, stop bits %d, handshaking %d, echo %d\n\r", - baud, - stopbits, - hardhand, // 0 = none, 1 = hard - echo); - - // FIXME implement serial port changes here - FILE* configfile = fopen("/tmp/instgettyopts", "w"); if(configfile) { fprintf(configfile, "OPTS=-L %s\n", hardhand ? "-h" : ""); @@ -4641,22 +4632,16 @@ int IO_Setup_RS232(int baud, char stopbits, char hardhand, char echo, gboolean u system("systemctl --no-block restart inst-getty@ttyO5.service"); } - if (1) { // FIXME if changes are successful - globals.Flash.baud = baud; - globals.Flash.stopbits = stopbits; - globals.Flash.hardhand = hardhand; - globals.Flash.echo = echo; + globals.Flash.baud = baud; + globals.Flash.hardhand = hardhand; - if (update_flash) { - int size = sizeof(globals.Flash.baud) + sizeof(globals.Flash.parity) + sizeof(globals.Flash.stopbits) + - sizeof(globals.Flash.databits) + sizeof(globals.Flash.hardhand) + sizeof(globals.Flash.echo); + if (update_flash) { + int size = sizeof(globals.Flash.baud) + sizeof(globals.Flash.parity) + sizeof(globals.Flash.stopbits) + + sizeof(globals.Flash.databits) + sizeof(globals.Flash.hardhand) + sizeof(globals.Flash.echo); - int eprom_loc = (char *) &(globals.Flash.baud) - (char *) &(globals.Flash.flash_start); - writeUserBlock(&globals.Flash, eprom_loc, size); - } - return OK; - } else { - return HardwareError; + int eprom_loc = (char *) &(globals.Flash.baud) - (char *) &(globals.Flash.flash_start); + writeUserBlock(&globals.Flash, eprom_loc, size); } + return OK; } diff --git a/device-functions.h b/device-functions.h index c676a2e..6625519 100644 --- a/device-functions.h +++ b/device-functions.h @@ -71,6 +71,6 @@ void Set_Sav(int setting_num); void Main_update_shift_registers(); -int IO_Setup_RS232(int baud, char stopbits, char handshake, char echo, gboolean update_flash); +int IO_Setup_RS232(int baud, char handshake, gboolean update_flash); #endif @@ -359,10 +359,10 @@ static void initFlashValues(FlashStruct *mem) mem->baud = 1200; mem->parity = rs232_parity_none; // no longer used - mem->stopbits = 1; + mem->stopbits = 1; // no longer used mem->databits = 8; // no longer used mem->hardhand = 1; - mem->echo = 1; + mem->echo = 1; // no longer used mem->on_off_used=1; @@ -408,10 +408,10 @@ typedef struct { int baud; /* 130 */ char parity; // no longer used - char stopbits; + char stopbits; // no longer used char databits; // no longer used char hardhand; - char echo; + char echo; // no longer used char spare1[23]; /* 139 */ @@ -425,12 +425,12 @@ void GPIB_initialize(void) // test to detect TNT chip if ((TNT_In(R_sts2) & 0xB0) == 0x90) { - is_gpib = 1; - } else { - is_gpib = 0; - printf ("Error: TNT4882 chip not found\n"); - return; - } + is_gpib = 1; + } else { + is_gpib = 0; + printf ("Error: TNT4882 chip not found\n"); + return; + } TNT_Out(R_cmdr,F_softreset); /* Reset FIFOS */ TNT_Out(R_spmr ,0x80); /* This sequence of commands */ diff --git a/instr-daemon.c b/instr-daemon.c index eaf0b07..f6d309d 100644 --- a/instr-daemon.c +++ b/instr-daemon.c @@ -231,9 +231,7 @@ int main(int argc, char **argv) GPIB_initialize(); IO_Setup_RS232( globals.Flash.baud, - globals.Flash.stopbits, globals.Flash.hardhand, - globals.Flash.echo, FALSE); /* start-up delay */ @@ -1592,14 +1592,6 @@ static void Submenu_Display(int change_selection) break; - case Submenu2_rs232_stopbits: - title = g_strdup ("Stop Bits:"); - Submenu_max_entry=1; - - Submenu_Structure[0]=mode_1bit; - Submenu_Structure[1]=mode_2bits; - break; - case Submenu2_rs232_hardhand: title = g_strdup ("Handshaking:"); Submenu_max_entry=1; @@ -1608,14 +1600,6 @@ static void Submenu_Display(int change_selection) Submenu_Structure[1]=mode_hand_off; break; - case Submenu2_rs232_echo: - title = g_strdup ("Echo:"); - Submenu_max_entry=1; - - Submenu_Structure[0]=mode_echo_on; - Submenu_Structure[1]=mode_echo_off; - break; - case Submenu2_gpib_address: title = g_strdup ("GPIB Address:"); Submenu_Numeric_Parameter=Show_gpib_address+channel; @@ -1994,18 +1978,6 @@ static void Submenu_Display(int change_selection) } break; - case mode_1bit: - strcpy(mode_name[i],"1 bit"); - if (globals.Flash.stopbits==1) { - current_operating_mode=i; - } - break; - case mode_2bits: - strcpy(mode_name[i],"2 bits"); - if (globals.Flash.stopbits==2) { - current_operating_mode=i; - } - break; case mode_hand_hard: strcpy(mode_name[i],"Hardware"); if (globals.Flash.hardhand) { @@ -2018,18 +1990,6 @@ static void Submenu_Display(int change_selection) current_operating_mode=i; } break; - case mode_echo_on: - strcpy(mode_name[i],"On"); - if (globals.Flash.echo) { - current_operating_mode=i; - } - break; - case mode_echo_off: - strcpy(mode_name[i],"Off"); - if (!globals.Flash.echo) { - current_operating_mode=i; - } - break; } } @@ -2749,12 +2709,12 @@ static void Nonstd_menu_default_rs232(void) Menu_Clear_Buttons(); LCD_clear(); /*0123456789012345678901234567890123456789*/ - LCD_write(0,0,"The RS232 settings are now: 1200 baud, "); - LCD_write(1,0,"1 stop bit, hardware handshaking on, "); - LCD_write(2,0,"and echo on."); + LCD_write(0,0,"The RS232 settings are now: 1200 baud,"); + LCD_write(1,0,"auto data bits / parity, 1 stop bit,"); + LCD_write(2,0,"hardware handshaking on, echo on."); LCD_write(3,0,Press_Change_Message); - IO_Setup_RS232(1200, 1, 1, 1, TRUE); + IO_Setup_RS232(1200, 1, TRUE); Menu_Clear_Buttons(); @@ -3273,86 +3233,66 @@ static int Submenu_Implement_Changes(void) globals.MenuStatus.Selected_Submenu=Submenu1_setup; break; case mode_1200: - IO_Setup_RS232(1200, globals.Flash.stopbits, globals.Flash.hardhand, globals.Flash.echo, FALSE); - globals.MenuStatus.Selected_Submenu=Submenu2_rs232_stopbits; + IO_Setup_RS232(1200, globals.Flash.hardhand, FALSE); + globals.MenuStatus.Selected_Submenu=Submenu2_rs232_hardhand; call_new_submenu=YES; Submenu_Display(NO); break; case mode_2400: - IO_Setup_RS232(2400, globals.Flash.stopbits, globals.Flash.hardhand, globals.Flash.echo, FALSE); - globals.MenuStatus.Selected_Submenu=Submenu2_rs232_stopbits; + IO_Setup_RS232(2400, globals.Flash.hardhand, FALSE); + globals.MenuStatus.Selected_Submenu=Submenu2_rs232_hardhand; call_new_submenu=YES; Submenu_Display(NO); break; case mode_4800: - IO_Setup_RS232(4800, globals.Flash.stopbits, globals.Flash.hardhand, globals.Flash.echo, FALSE); - globals.MenuStatus.Selected_Submenu=Submenu2_rs232_stopbits; + IO_Setup_RS232(4800, globals.Flash.hardhand, FALSE); + globals.MenuStatus.Selected_Submenu=Submenu2_rs232_hardhand; call_new_submenu=YES; Submenu_Display(NO); break; case mode_9600: - IO_Setup_RS232(9600, globals.Flash.stopbits, globals.Flash.hardhand, globals.Flash.echo, FALSE); - globals.MenuStatus.Selected_Submenu=Submenu2_rs232_stopbits; + IO_Setup_RS232(9600, globals.Flash.hardhand, FALSE); + globals.MenuStatus.Selected_Submenu=Submenu2_rs232_hardhand; call_new_submenu=YES; Submenu_Display(NO); break; case mode_19200: - IO_Setup_RS232(19200, globals.Flash.stopbits, globals.Flash.hardhand, globals.Flash.echo, FALSE); - globals.MenuStatus.Selected_Submenu=Submenu2_rs232_stopbits; + IO_Setup_RS232(19200, globals.Flash.hardhand, FALSE); + globals.MenuStatus.Selected_Submenu=Submenu2_rs232_hardhand; call_new_submenu=YES; Submenu_Display(NO); break; case mode_38400: - IO_Setup_RS232(38400, globals.Flash.stopbits, globals.Flash.hardhand, globals.Flash.echo, FALSE); - globals.MenuStatus.Selected_Submenu=Submenu2_rs232_stopbits; + IO_Setup_RS232(38400, globals.Flash.hardhand, FALSE); + globals.MenuStatus.Selected_Submenu=Submenu2_rs232_hardhand; call_new_submenu=YES; Submenu_Display(NO); break; case mode_57600: - IO_Setup_RS232(57600, globals.Flash.stopbits, globals.Flash.hardhand, globals.Flash.echo, FALSE); - globals.MenuStatus.Selected_Submenu=Submenu2_rs232_stopbits; - call_new_submenu=YES; - Submenu_Display(NO); - break; - case mode_115200: - IO_Setup_RS232(115200, globals.Flash.stopbits, globals.Flash.hardhand, globals.Flash.echo, FALSE); - globals.MenuStatus.Selected_Submenu=Submenu2_rs232_stopbits; - call_new_submenu=YES; - Submenu_Display(NO); - break; - - case mode_1bit: - IO_Setup_RS232(globals.Flash.baud, 1, globals.Flash.hardhand, globals.Flash.echo, FALSE); + IO_Setup_RS232(57600, globals.Flash.hardhand, FALSE); globals.MenuStatus.Selected_Submenu=Submenu2_rs232_hardhand; call_new_submenu=YES; Submenu_Display(NO); break; - case mode_2bits: - IO_Setup_RS232(globals.Flash.baud, 2, globals.Flash.hardhand, globals.Flash.echo, FALSE); + case mode_115200: + IO_Setup_RS232(115200, globals.Flash.hardhand, FALSE); globals.MenuStatus.Selected_Submenu=Submenu2_rs232_hardhand; call_new_submenu=YES; Submenu_Display(NO); break; + case mode_hand_hard: - IO_Setup_RS232(globals.Flash.baud, globals.Flash.stopbits, 1, globals.Flash.echo, FALSE); - globals.MenuStatus.Selected_Submenu=Submenu2_rs232_echo; + IO_Setup_RS232(globals.Flash.baud, 1, FALSE); + globals.MenuStatus.Selected_Submenu=Submenu1_setup; call_new_submenu=YES; Submenu_Display(NO); break; case mode_hand_off: - IO_Setup_RS232(globals.Flash.baud, globals.Flash.stopbits, 0, globals.Flash.echo, FALSE); - globals.MenuStatus.Selected_Submenu=Submenu2_rs232_echo; + IO_Setup_RS232(globals.Flash.baud, 0, FALSE); + globals.MenuStatus.Selected_Submenu=Submenu1_setup; call_new_submenu=YES; Submenu_Display(NO); break; - case mode_echo_on: - IO_Setup_RS232(globals.Flash.baud, globals.Flash.stopbits, globals.Flash.hardhand, 1, TRUE); - globals.MenuStatus.Selected_Submenu=Submenu1_setup; - break; - case mode_echo_off: - IO_Setup_RS232(globals.Flash.baud, globals.Flash.stopbits, globals.Flash.hardhand, 0, TRUE); - globals.MenuStatus.Selected_Submenu=Submenu1_setup; - break; } Main_update_shift_registers(); /* update values in pulse generator circuit */ @@ -90,9 +90,7 @@ static int Go_zout_20(gchar** response, int channel, char *parameter,char *units static int Go_prot_trip_21(gchar** response, int channel, char *parameter,char *units,int command_type); static int Go_gpib_addr_59(gchar** response, int channel, char *parameter,char *units,int command_type); static int Go_ser_baud_60(gchar** response, int channel, char *parameter,char *units,int command_type); -static int Go_ser_sbits_63(gchar** response, int channel, char *parameter,char *units,int command_type); static int Go_ser_rts_64(gchar** response, int channel, char *parameter,char *units,int command_type); -static int Go_ser_echo_65(gchar** response, int channel, char *parameter,char *units,int command_type); static int Go_load_68(gchar** response, int channel, char *parameter,char *units,int command_type); static int Go_meas_ampl_69(gchar** response, int channel, char *parameter,char *units,int command_type); static int Go_rst_6(gchar** response, int channel, char *parameter,char *units,int command_type); @@ -442,9 +440,9 @@ static int Parser_find_commands(int commands[], int command_depth) {13,68,71,72|optional,73}, /* syst:comm:ser:rec:baud - 60 */ {13,68,71,72|optional,74,75|optional}, /* syst:comm:ser:rec:parity - 61 - not used */ {13,68,71,72|optional,76}, /* syst:comm:ser:rec:bits - 62 - not used */ - {13,68,71,72|optional,77}, /* syst:comm:ser:rec:sbits - 63 */ + {13,68,71,72|optional,77}, /* syst:comm:ser:rec:sbits - 63 - not used */ {13,68,71,80,79}, /* syst:comm:ser:control:rts - 64 */ - {13,68,71,72|optional,78}, /* syst:comm:ser:rec:echo - 65 */ + {13,68,71,72|optional,78}, /* syst:comm:ser:rec:echo - 65 - not used */ {13,14,82}, /* syst:err:count - 66 */ {28|optional,40,65,30}, /* sour:puls:gate:level - 67 */ {24,85}, /* output:load - 68 */ @@ -942,15 +940,9 @@ void Parser_main (char *raw_in, int interactive_terminal, void(*cbfunc)(gpointer case 60: error_num=Go_ser_baud_60(&response,channel,parameter,units,command_type); break; - case 63: - error_num=Go_ser_sbits_63(&response,channel,parameter,units,command_type); - break; case 64: error_num=Go_ser_rts_64(&response,channel,parameter,units,command_type); break; - case 65: - error_num=Go_ser_echo_65(&response,channel,parameter,units,command_type); - break; case 66: error_num=Go_syst_errcnt66(&response,channel,parameter,units,command_type); break; @@ -2731,7 +2723,7 @@ static int Go_ser_baud_60(gchar** response, int channel, char *parameter,char *u if (status = process_int_param (parameter, &new_baud, 8, valid_choices, NO_ON_OFF)) { return status; } - return IO_Setup_RS232(new_baud, globals.Flash.stopbits, globals.Flash.hardhand, globals.Flash.echo, TRUE); + return IO_Setup_RS232(new_baud, globals.Flash.hardhand, TRUE); break; case query_simple: @@ -2751,37 +2743,6 @@ static int Go_ser_baud_60(gchar** response, int channel, char *parameter,char *u } -static int Go_ser_sbits_63(gchar** response, int channel, char *parameter,char *units,int command_type) -{ - int new_stopbits; - int status; - - switch (command_type) { - case command_withparam: - if (status=process_two_ints (parameter, &new_stopbits, 1, 2)) { - return status; - } - - return IO_Setup_RS232(globals.Flash.baud, (char) new_stopbits, globals.Flash.hardhand, globals.Flash.echo, TRUE); - break; - - case query_simple: - return query_int (response, globals.Flash.stopbits); - break; - - case query_param: - return query_min_max_int (response, parameter, 1, 2); - break; - - default: - return SyntaxError; - break; - } - - return ThisShouldntHappen; -} - - static int Go_ser_rts_64(gchar** response, int channel, char *parameter,char *units,int command_type) { char new_hardhand; @@ -2800,7 +2761,7 @@ static int Go_ser_rts_64(gchar** response, int channel, char *parameter,char *un return IllegalParameter; } - return IO_Setup_RS232(globals.Flash.baud, globals.Flash.stopbits, new_hardhand, globals.Flash.echo, TRUE); + return IO_Setup_RS232(globals.Flash.baud, new_hardhand, TRUE); break; case query_simple: @@ -2823,37 +2784,6 @@ static int Go_ser_rts_64(gchar** response, int channel, char *parameter,char *un } -static int Go_ser_echo_65(gchar** response, int channel, char *parameter,char *units,int command_type) -{ - int new_echo; - int status; - - switch (command_type) { - case command_withparam: - if (status=process_on_off (parameter, &new_echo)) { - return status; - } - return IO_Setup_RS232(globals.Flash.baud, globals.Flash.stopbits, globals.Flash.hardhand, (char) new_echo, TRUE); - break; - - case query_simple: - if (globals.Flash.echo) { - return query_int (response, 1); - } else { - return query_int (response, 0); - } - return OK; - break; - - default: - return SyntaxError; - break; - } - - return ThisShouldntHappen; -} - - static int Go_load_68(gchar** response, int channel, char *parameter,char *units,int command_type) { float new_load_type; |