diff options
Diffstat (limited to 'parser.c')
-rw-r--r-- | parser.c | 121 |
1 files changed, 121 insertions, 0 deletions
@@ -116,6 +116,7 @@ static int Go_cal_100(gchar** response, int channel, char *parameter,char *units static int Go_cal_interval_101(gchar** response, int channel, char *parameter,char *units,int command_type); static int Go_eprom_reset_102(gchar** response, int channel, char *parameter,char *units,int command_type); static int Go_atten_103(gchar** response, int channel, char *parameter,char *units,int command_type); +static int Go_eprom_resize_105(gchar** response, int channel, char *parameter,char *units,int command_type); static int Parser_id_word(char *id_me, int *channel, int *with_id_code) { @@ -355,6 +356,8 @@ static int Parser_id_word(char *id_me, int *channel, int *with_id_code) id_code = 109; } else if (!strcmp(id_me,"distort")) { id_code = 110; + } else if (!strcmp(id_me,"resize")) { + id_code = 111; } else { id_code = 9999; } @@ -482,6 +485,7 @@ static int Parser_find_commands(int commands[], int command_depth) {23,57,108}, /* diag:eprom:reset - 102 */ {23,109,16|optional}, /* diag:attenuator:state - 103 */ {23,32,110,88,93}, /* diag:ampl:distort:calib:point - 104 */ + {23,57,111}, /* diag:eprom:resize - 105 */ }; @@ -1053,6 +1057,9 @@ void Parser_main (char *raw_in, int interactive_terminal, void(*cbfunc)(gpointer case 104: error_num=Go_amp_pnt_83(&response,channel,parameter,units,command_type,pwl_distort_values); break; + case 105: + error_num=Go_eprom_resize_105(&response,channel,parameter,units,command_type); + break; case 9999: // was only whitespace, ignore @@ -4058,3 +4065,117 @@ static int Go_atten_103(gchar** response, int channel, char *parameter,char *uni } +static int Go_eprom_resize_105(gchar** response, int channel, char *parameter,char *units,int command_type) +{ + /* copies data from old ten-point-ranges into new-style (May 2018) 32-point ranges */ + + int i, j, k, l; + + if (channel) { + return InvalidChannel; + } + + switch (command_type) { + case command_simple: + + for (i=0;i<max_channels;i++) { + for (l=0;l<old_range_size_ten;l++) { + + for (j=0;j<ampl_ranges;j++) { + for (k=0;k<ampl_polarities;k++) { + globals.Flash.ampl_dacval[i][j][k][l] = globals.Flash.obs_ampl_dacval[i][j][k][l]; + globals.Flash.ampl_pwl[i][j][k][l] = globals.Flash.obs_ampl_pwl[i][j][k][l]; + globals.Flash.distort_dacval[i][j][k][l] = globals.Flash.obs_distort_dacval[i][j][k][l]; + globals.Flash.rise_time_dacval[i][j][k][l] = globals.Flash.obs_rise_time_dacval[i][j][k][l]; + globals.Flash.rise_time_pwl[i][j][k][l] = globals.Flash.obs_rise_time_pwl[i][j][k][l]; + } + } + + for (j=0;j<os_ranges;j++) { + for (k=0;k<os_polarities;k++) { + globals.Flash.os_dacval[i][j][k][l] = globals.Flash.obs_os_dacval[i][j][k][l]; + globals.Flash.os_pwl[i][j][k][l] = globals.Flash.obs_os_pwl[i][j][k][l]; + } + } + + for (j=0;j<load_type_ranges;j++) { + for (k=0;k<load_type_polarities;k++) { + globals.Flash.load_type_dacval[i][j][k][l] = globals.Flash.obs_load_type_dacval[i][j][k][l]; + globals.Flash.load_type_pwl[i][j][k][l] = globals.Flash.obs_load_type_pwl[i][j][k][l]; + } + } + + for (j=0;j<timing_ranges;j++) { + for (k=0;k<timing_polarities;k++) { + globals.Flash.pw_dacval[i][j][k][l] = globals.Flash.obs_pw_dacval[i][j][k][l]; + globals.Flash.pw_pwl[i][j][k][l] = globals.Flash.obs_pw_pwl[i][j][k][l]; + globals.Flash.delay_dacval[i][j][k][l] = globals.Flash.obs_delay_dacval[i][j][k][l]; + globals.Flash.delay_pwl[i][j][k][l] = globals.Flash.obs_delay_pwl[i][j][k][l]; + globals.Flash.period_dacval[i][j][k][l] = globals.Flash.obs_period_dacval[i][j][k][l]; + globals.Flash.period_pwl[i][j][k][l] = globals.Flash.obs_period_pwl[i][j][k][l]; + globals.Flash.burst_dacval[i][j][k][l] = globals.Flash.obs_burst_dacval[i][j][k][l]; + globals.Flash.burst_pwl[i][j][k][l] = globals.Flash.obs_burst_pwl[i][j][k][l]; + globals.Flash.slew_dacval[i][j][k][l] = globals.Flash.obs_slew_dacval[i][j][k][l]; + globals.Flash.slew_pwl[i][j][k][l] = globals.Flash.obs_slew_pwl[i][j][k][l]; + } + } + + } + + for (l=old_range_size_ten;l<std_range_size;l++) { + + for (j=0;j<ampl_ranges;j++) { + for (k=0;k<ampl_polarities;k++) { + globals.Flash.ampl_dacval[i][j][k][l] = 0; + globals.Flash.ampl_pwl[i][j][k][l] = 0; + globals.Flash.distort_dacval[i][j][k][l] = 0; + globals.Flash.rise_time_dacval[i][j][k][l] = 0; + globals.Flash.rise_time_pwl[i][j][k][l] = 0; + } + } + + for (j=0;j<os_ranges;j++) { + for (k=0;k<os_polarities;k++) { + globals.Flash.os_dacval[i][j][k][l] = 0; + globals.Flash.os_pwl[i][j][k][l] = 0; + } + } + + for (j=0;j<load_type_ranges;j++) { + for (k=0;k<load_type_polarities;k++) { + globals.Flash.load_type_dacval[i][j][k][l] = 0; + globals.Flash.load_type_pwl[i][j][k][l] = 0; + } + } + + for (j=0;j<timing_ranges;j++) { + for (k=0;k<timing_polarities;k++) { + globals.Flash.pw_dacval[i][j][k][l] = 0; + globals.Flash.pw_pwl[i][j][k][l] = 0; + globals.Flash.delay_dacval[i][j][k][l] = 0; + globals.Flash.delay_pwl[i][j][k][l] = 0; + globals.Flash.period_dacval[i][j][k][l] = 0; + globals.Flash.period_pwl[i][j][k][l] = 0; + globals.Flash.burst_dacval[i][j][k][l] = 0; + globals.Flash.burst_pwl[i][j][k][l] = 0; + globals.Flash.slew_dacval[i][j][k][l] = 0; + globals.Flash.slew_pwl[i][j][k][l] = 0; + } + } + } + } + + writeUserBlock(&globals.Flash,0,sizeof(globals.Flash)); + + Main_Rst(); + return OK; + break; + + default: + return SyntaxError; + break; + } + + return ThisShouldntHappen; +} + |