summaryrefslogtreecommitdiff
path: root/device-functions.c
diff options
context:
space:
mode:
Diffstat (limited to 'device-functions.c')
-rw-r--r--device-functions.c132
1 files changed, 66 insertions, 66 deletions
diff --git a/device-functions.c b/device-functions.c
index 3acfb49..c083f42 100644
--- a/device-functions.c
+++ b/device-functions.c
@@ -3072,15 +3072,15 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point)
float abs_cal_point;
int max_points,max_polarity,max_ranges;
- float temp_y_float[points_in_range+1];
- float temp_x_float[points_in_range+1];
- int temp_x_short[points_in_range+1];
+ float temp_y_float1[points_in_range+1];
+ float temp_x_float1[points_in_range+1]; /* float copy of short, for calculations */
+ int temp_x_short1[points_in_range+1];
int index,actual_pol;
- float *pointer_y_float;
- short *pointer_x_short;
+ float *pointer_y_float1;
+ short *pointer_x_short1;
- int eprom_loc,size_of_y_float,size_of_x_short;
+ int eprom_loc,size_of_y_float1,size_of_x_short1;
int true_channel;
@@ -3097,10 +3097,10 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point)
max_polarity=ampl_polarities;
max_ranges=ampl_ranges;
- pointer_x_short=&globals.Flash.ampl_dacval[0][0][0][0];
- pointer_y_float=&globals.Flash.ampl_pwl[0][0][0][0];
- size_of_x_short=sizeof(globals.Flash.ampl_dacval);
- size_of_y_float=sizeof(globals.Flash.ampl_pwl);
+ pointer_x_short1=&globals.Flash.ampl_dacval[0][0][0][0];
+ pointer_y_float1=&globals.Flash.ampl_pwl[0][0][0][0];
+ size_of_x_short1=sizeof(globals.Flash.ampl_dacval);
+ size_of_y_float1=sizeof(globals.Flash.ampl_pwl);
Set_VI_Control(pwl_ampl_values,channel,globals.ChannelState[channel].amplitude,&point_found,
&range,&atten_range,&polarity,&entry,&word_out,&actual_pol,NULL);
@@ -3117,10 +3117,10 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point)
case (pwl_os_values):
max_polarity=os_polarities;
max_ranges=os_ranges;
- pointer_x_short=&globals.Flash.os_dacval[0][0][0][0];
- pointer_y_float=&globals.Flash.os_pwl[0][0][0][0];
- size_of_x_short=sizeof(globals.Flash.os_dacval);
- size_of_y_float=sizeof(globals.Flash.os_pwl);
+ pointer_x_short1=&globals.Flash.os_dacval[0][0][0][0];
+ pointer_y_float1=&globals.Flash.os_pwl[0][0][0][0];
+ size_of_x_short1=sizeof(globals.Flash.os_dacval);
+ size_of_y_float1=sizeof(globals.Flash.os_pwl);
old_val=globals.ChannelState[channel].offset;
Set_VI_Control(pwl_os_values,channel,old_val,&point_found,
@@ -3129,10 +3129,10 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point)
case pwl_pw_values:
max_polarity=timing_polarities;
max_ranges=timing_ranges;
- pointer_x_short=&globals.Flash.pw_dacval[0][0][0][0];
- pointer_y_float=&globals.Flash.pw_pwl[0][0][0][0];
- size_of_x_short=sizeof(globals.Flash.pw_dacval);
- size_of_y_float=sizeof(globals.Flash.pw_pwl);
+ pointer_x_short1=&globals.Flash.pw_dacval[0][0][0][0];
+ pointer_y_float1=&globals.Flash.pw_pwl[0][0][0][0];
+ size_of_x_short1=sizeof(globals.Flash.pw_dacval);
+ size_of_y_float1=sizeof(globals.Flash.pw_pwl);
old_val=globals.ChannelState[channel].pw;
Set_VI_Control(pwl_pw_values,channel,old_val,&point_found,
&range,&atten_range,&polarity,&entry,&word_out,&actual_pol,NULL);
@@ -3140,10 +3140,10 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point)
case pwl_delay_values:
max_polarity=timing_polarities;
max_ranges=timing_ranges;
- pointer_x_short=&globals.Flash.delay_dacval[0][0][0][0];
- pointer_y_float=&globals.Flash.delay_pwl[0][0][0][0];
- size_of_x_short=sizeof(globals.Flash.delay_dacval);
- size_of_y_float=sizeof(globals.Flash.delay_pwl);
+ pointer_x_short1=&globals.Flash.delay_dacval[0][0][0][0];
+ pointer_y_float1=&globals.Flash.delay_pwl[0][0][0][0];
+ size_of_x_short1=sizeof(globals.Flash.delay_dacval);
+ size_of_y_float1=sizeof(globals.Flash.delay_pwl);
old_val=globals.ChannelState[channel].delay;
Set_VI_Control(pwl_delay_values,channel,old_val,&point_found,
&range,&atten_range,&polarity,&entry,&word_out,&actual_pol,NULL);
@@ -3151,10 +3151,10 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point)
case pwl_period_values:
max_polarity=timing_polarities;
max_ranges=timing_ranges;
- pointer_x_short=&globals.Flash.period_dacval[0][0][0][0];
- pointer_y_float=&globals.Flash.period_pwl[0][0][0][0];
- size_of_x_short=sizeof(globals.Flash.period_dacval);
- size_of_y_float=sizeof(globals.Flash.period_pwl);
+ pointer_x_short1=&globals.Flash.period_dacval[0][0][0][0];
+ pointer_y_float1=&globals.Flash.period_pwl[0][0][0][0];
+ size_of_x_short1=sizeof(globals.Flash.period_dacval);
+ size_of_y_float1=sizeof(globals.Flash.period_pwl);
old_val=1.0/globals.ChannelState[channel].frequency;
Set_VI_Control(pwl_period_values,channel,old_val,&point_found,
&range,&atten_range,&polarity,&entry,&word_out,&actual_pol,NULL);
@@ -3162,10 +3162,10 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point)
case pwl_burst_values:
max_polarity=timing_polarities;
max_ranges=timing_ranges;
- pointer_x_short=&globals.Flash.burst_dacval[0][0][0][0];
- pointer_y_float=&globals.Flash.burst_pwl[0][0][0][0];
- size_of_x_short=sizeof(globals.Flash.burst_dacval);
- size_of_y_float=sizeof(globals.Flash.burst_pwl);
+ pointer_x_short1=&globals.Flash.burst_dacval[0][0][0][0];
+ pointer_y_float1=&globals.Flash.burst_pwl[0][0][0][0];
+ size_of_x_short1=sizeof(globals.Flash.burst_dacval);
+ size_of_y_float1=sizeof(globals.Flash.burst_pwl);
old_val=globals.ChannelState[channel].burst_time;
Set_VI_Control(pwl_burst_values,channel,old_val,&point_found,
&range,&atten_range,&polarity,&entry,&word_out,&actual_pol,NULL);
@@ -3173,10 +3173,10 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point)
case pwl_rise_time_values:
max_polarity=ampl_polarities;
max_ranges=ampl_ranges;
- pointer_x_short=&globals.Flash.rise_time_dacval[0][0][0][0];
- pointer_y_float=&globals.Flash.rise_time_pwl[0][0][0][0];
- size_of_x_short=sizeof(globals.Flash.rise_time_dacval);
- size_of_y_float=sizeof(globals.Flash.rise_time_pwl);
+ pointer_x_short1=&globals.Flash.rise_time_dacval[0][0][0][0];
+ pointer_y_float1=&globals.Flash.rise_time_pwl[0][0][0][0];
+ size_of_x_short1=sizeof(globals.Flash.rise_time_dacval);
+ size_of_y_float1=sizeof(globals.Flash.rise_time_pwl);
old_val=globals.ChannelState[channel].rise_time;
Set_VI_Control(pwl_rise_time_values,channel,old_val,&point_found,
&range,&atten_range,&polarity,&entry,&word_out,&actual_pol,NULL);
@@ -3184,10 +3184,10 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point)
case pwl_slew_values:
max_polarity=timing_polarities;
max_ranges=timing_ranges;
- pointer_x_short=&globals.Flash.slew_dacval[0][0][0][0];
- pointer_y_float=&globals.Flash.slew_pwl[0][0][0][0];
- size_of_x_short=sizeof(globals.Flash.slew_dacval);
- size_of_y_float=sizeof(globals.Flash.slew_pwl);
+ pointer_x_short1=&globals.Flash.slew_dacval[0][0][0][0];
+ pointer_y_float1=&globals.Flash.slew_pwl[0][0][0][0];
+ size_of_x_short1=sizeof(globals.Flash.slew_dacval);
+ size_of_y_float1=sizeof(globals.Flash.slew_pwl);
old_val=globals.ChannelState[channel].slew;
Set_VI_Control(pwl_slew_values,channel,old_val,&point_found,
&range,&atten_range,&polarity,&entry,&word_out,&actual_pol,NULL);
@@ -3195,9 +3195,9 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point)
}
- temp_y_float[max_points]=0.0; /* Adding a cal point may temporarily result in 11 data points. */
- temp_x_float[max_points]=0.0; /* One is eventually discarded. */
- temp_x_short[max_points]=0;
+ temp_y_float1[max_points]=0.0; /* Adding a cal point may temporarily result in 11 data points. */
+ temp_x_float1[max_points]=0.0; /* One is eventually discarded. */
+ temp_x_short1[max_points]=0;
index=true_channel*max_ranges*max_polarity*max_points
@@ -3207,8 +3207,8 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point)
/* make a copy of the calibration data in this range */
for (i=0; i<max_points; i++) {
- temp_y_float[i]=pointer_y_float[index+i]; /* work on this data */
- temp_x_short[i]=pointer_x_short[index+i];
+ temp_y_float1[i]=pointer_y_float1[index+i]; /* work on this data */
+ temp_x_short1[i]=pointer_x_short1[index+i];
}
@@ -3216,11 +3216,11 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point)
max_in_range=0.0;
total=max_points;
for (i=max_points-1; i>=0; --i) {
- if ( fabs(temp_y_float[i])<smallest_allowed_number && (total==i+1)) {
+ if ( fabs(temp_y_float1[i])<smallest_allowed_number && (total==i+1)) {
--total;
}
- if (fabs(temp_y_float[i])>max_in_range) {
- max_in_range=fabs(temp_y_float[i]);
+ if (fabs(temp_y_float1[i])>max_in_range) {
+ max_in_range=fabs(temp_y_float1[i]);
}
}
@@ -3230,10 +3230,10 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point)
return CalibrationPercentError;
}
/* check for overly-close data points */
- if ( word_out==temp_x_short[entry] ) {
+ if ( word_out==temp_x_short1[entry] ) {
return CalibrationClosenessError;
}
- if ( word_out==temp_x_short[entry+1]) {
+ if ( word_out==temp_x_short1[entry+1]) {
return CalibrationClosenessError;
}
@@ -3241,16 +3241,16 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point)
/* move old data over */
for (i=max_points-1; i>entry; i--) {
- temp_y_float[i+1]=temp_y_float[i];
- temp_x_short[i+1]=temp_x_short[i];
+ temp_y_float1[i+1]=temp_y_float1[i];
+ temp_x_short1[i+1]=temp_x_short1[i];
}
/* add the new data */
- temp_y_float[entry+1]=abs_cal_point;
- temp_x_short[entry+1]=word_out;
+ temp_y_float1[entry+1]=abs_cal_point;
+ temp_x_short1[entry+1]=word_out;
for (i=0; i<=max_points; ++i) {
- temp_x_float[i]=(float) temp_x_short[i];
+ temp_x_float1[i]=(float) temp_x_short1[i];
}
@@ -3260,14 +3260,14 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point)
for (i=1; i<max_points; i++) { /* end points are not considered for deletion */
/* calculate interpolated amplitude, if this cal point was deleted */
- fraction = (temp_x_float[i]-temp_x_float[i-1]) / (temp_x_float[i+1]-temp_x_float[i-1]);
- interp_ampl = temp_y_float[i-1] + (fraction * (temp_y_float[i+1]-temp_y_float[i-1]));
+ fraction = (temp_x_float1[i]-temp_x_float1[i-1]) / (temp_x_float1[i+1]-temp_x_float1[i-1]);
+ interp_ampl = temp_y_float1[i-1] + (fraction * (temp_y_float1[i+1]-temp_y_float1[i-1]));
/* calculate percent error at interpolated point */
- integrated_error = fabs( (interp_ampl-temp_y_float[i])/temp_y_float[i]);
+ integrated_error = fabs( (interp_ampl-temp_y_float1[i])/temp_y_float1[i]);
/* calculate intergrated error */
- integrated_error *= fabs( temp_y_float[i+1] - temp_y_float[i-1] );
+ integrated_error *= fabs( temp_y_float1[i+1] - temp_y_float1[i-1] );
if (integrated_error<least_integrated_error) {
delete_point=i;
@@ -3277,24 +3277,24 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point)
/* delete the point that is most linear with the two around it */
for (i=delete_point; i<max_points; i++) {
- temp_y_float[i]=temp_y_float[i+1];
- temp_x_float[i]=temp_x_float[i+1];
- temp_x_short[i]=temp_x_short[i+1];
+ temp_y_float1[i]=temp_y_float1[i+1];
+ temp_x_float1[i]=temp_x_float1[i+1];
+ temp_x_short1[i]=temp_x_short1[i+1];
}
}
/* store new calibration data for this range */
for (i=0; i<max_points; i++) {
- *(float *)(&pointer_y_float[index+i])=temp_y_float[i];
- *(short *)(&pointer_x_short[index+i])=temp_x_short[i];
+ *(float *)(&pointer_y_float1[index+i])=temp_y_float1[i];
+ *(short *)(&pointer_x_short1[index+i])=temp_x_short1[i];
}
- eprom_loc = (char *) pointer_x_short - (char *) &(globals.Flash.flash_start);
- writeUserBlock(&globals.Flash, eprom_loc, size_of_x_short);
+ eprom_loc = (char *) pointer_x_short1 - (char *) &(globals.Flash.flash_start);
+ writeUserBlock(&globals.Flash, eprom_loc, size_of_x_short1);
- eprom_loc = (char *) pointer_y_float - (char *) &(globals.Flash.flash_start);
- writeUserBlock(&globals.Flash, eprom_loc, size_of_y_float);
+ eprom_loc = (char *) pointer_y_float1 - (char *) &(globals.Flash.flash_start);
+ writeUserBlock(&globals.Flash, eprom_loc, size_of_y_float1);
globals.Flags.extended_ampl_min_max=NO;