summaryrefslogtreecommitdiff
path: root/device-functions.c
diff options
context:
space:
mode:
authorMichael J. Chudobiak <mjc@avtechpulse.com>2012-08-24 14:04:56 -0400
committerMichael J. Chudobiak <mjc@avtechpulse.com>2012-08-24 14:04:56 -0400
commitb3c38cf2f99e387359653fc9f9530239c38c381d (patch)
tree781cd5ea77c24a7344bfa4d1d68151c61223143b /device-functions.c
parent37715d8b1b2a6465f1bb8232df8ae9c73efc743b (diff)
fix writeUserBlock usage, and fix non-obvious rcl values
Diffstat (limited to 'device-functions.c')
-rw-r--r--device-functions.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/device-functions.c b/device-functions.c
index f2d7aec..db36caf 100644
--- a/device-functions.c
+++ b/device-functions.c
@@ -6,6 +6,7 @@
#include "i2c.h"
#include "bus.h"
#include "lcd.h"
+#include "flash.h"
#include <math.h>
#include <glib.h>
@@ -1502,7 +1503,7 @@ int Set_Amp_Calib(int channel,float meas_ampl)
}
eprom_loc = (char *) &(globals.Flash.ampl_pwl_amp) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(eprom_loc,&globals.Flash.flash_start + eprom_loc,sizeof(globals.Flash.ampl_pwl_amp));
+ writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.ampl_pwl_amp));
return status;
}
@@ -1538,7 +1539,7 @@ int Set_Mon_Calib(int channel,float meas_ampl)
globals.Flash.mon_vi_ratio[channel][relay_range][UseNegData]=globals.Flash.mon_vi_ratio[channel][relay_range][UseNegData]/change_ratio;
eprom_loc = (char *) &(globals.Flash.mon_vi_ratio) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(eprom_loc,&globals.Flash.flash_start + eprom_loc,sizeof(globals.Flash.mon_vi_ratio));
+ writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.mon_vi_ratio));
return OK;
}
@@ -1607,7 +1608,7 @@ int Set_OS_Calib(int channel,float meas_ampl)
}
eprom_loc = (char *) &(globals.Flash.os_pwl_amp) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(eprom_loc,&globals.Flash.flash_start + eprom_loc,sizeof(globals.Flash.os_pwl_amp));
+ writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.os_pwl_amp));
return status;
}
@@ -1647,7 +1648,7 @@ int Set_PW_shift(int channel,float new_shift)
}
eprom_loc = (char *) &(globals.Flash.pulse_width_pol_tweak[channel][UseNegData]) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(eprom_loc,&globals.Flash.flash_start + eprom_loc,sizeof(globals.Flash.pulse_width_pol_tweak[channel][UseNegData]));
+ writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.pulse_width_pol_tweak[channel][UseNegData]));
return Set_Pw(0,0,0,channel,globals.ChannelState[channel].pw,0);
}
@@ -1822,10 +1823,10 @@ int Set_Dly_Shr_Cal(int channel,int calibration_point_number,float cal_point)
globals.Flash.delay_shrink[channel]=( (150e-9)-delay1+delay2)/2;
eprom_loc = (char *) &(globals.Flash.propagation_delay) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(eprom_loc,&globals.Flash.flash_start + eprom_loc,sizeof(globals.Flash.propagation_delay));
+ writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.propagation_delay));
eprom_loc = (char *) &(globals.Flash.delay_shrink) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(eprom_loc,&globals.Flash.flash_start + eprom_loc,sizeof(globals.Flash.delay_shrink));
+ writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.delay_shrink));
return OK;
}
@@ -2235,7 +2236,7 @@ int Set_VI_Cal_Pnt(int parameter,int channel,int calibration_point_number,float
Menu_Update_Display();
eprom_loc = (char *) (&pwl_amp[index]) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(eprom_loc,&globals.Flash.flash_start + eprom_loc,sizeof(nom_ampl));
+ writeUserBlock(&globals.Flash, eprom_loc, sizeof(nom_ampl));
globals.Flags.extended_ampl_min_max=NO;
return status;
@@ -2398,10 +2399,10 @@ int Set_VI_Del_Cal(int parameter,int channel,int calibration_point_number)
Menu_Update_Display();
eprom_loc = (char *) pointer_short1 - (char *) &(globals.Flash.flash_start);
- writeUserBlock(eprom_loc,&globals.Flash.flash_start + eprom_loc,size_of_short1);
+ writeUserBlock(&globals.Flash, eprom_loc, size_of_short1);
eprom_loc = (char *) pointer_float1 - (char *) &(globals.Flash.flash_start);
- writeUserBlock(eprom_loc,&globals.Flash.flash_start + eprom_loc,size_of_float1);
+ writeUserBlock(&globals.Flash, eprom_loc, size_of_float1);
return status;
}
@@ -3063,10 +3064,10 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point)
}
eprom_loc = (char *) pointer_x_short - (char *) &(globals.Flash.flash_start);
- writeUserBlock(eprom_loc,&globals.Flash.flash_start + eprom_loc,size_of_x_short);
+ writeUserBlock(&globals.Flash, eprom_loc, size_of_x_short);
eprom_loc = (char *) pointer_y_float - (char *) &(globals.Flash.flash_start);
- writeUserBlock(eprom_loc,&globals.Flash.flash_start + eprom_loc,size_of_y_float);
+ writeUserBlock(&globals.Flash, eprom_loc, size_of_y_float);
globals.Flags.extended_ampl_min_max=NO;
@@ -4192,9 +4193,9 @@ int do_full_self_cal(CalStruct *caldata)
strcat (caldata->response, string);
eprom_loc = (char *) &(globals.Flash.self_cal_typical_time_min) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(eprom_loc,&globals.Flash.flash_start + eprom_loc,sizeof(globals.Flash.self_cal_typical_time_min));
+ writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.self_cal_typical_time_min));
eprom_loc = (char *) &(globals.Flash.self_cal_typical_time_sec) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(eprom_loc,&globals.Flash.flash_start + eprom_loc,sizeof(globals.Flash.self_cal_typical_time_sec));
+ writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.self_cal_typical_time_sec));
if (caldata->total_errors) {
return SelfCalError;