diff options
Diffstat (limited to 'flash.c')
-rw-r--r-- | flash.c | 78 |
1 files changed, 36 insertions, 42 deletions
@@ -272,10 +272,10 @@ static int readUserBlock(FlashStruct *mem) // hopefully we can use the backup.. if (persistence_unfreeze(BACKUPFILE, mem, sizeof(*mem), 0)) { // if the backup was good overwrite the main file - if (!globals.Flags.shutdown_started) { - globals.Flags.flash_write_in_progress = TRUE; + if (!globals.Sys.shutdown_started) { + globals.Sys.flash_write_in_progress = TRUE; persistence_copyfile(BACKUPFILE, MAINFILE); - globals.Flags.flash_write_in_progress = FALSE; + globals.Sys.flash_write_in_progress = FALSE; } return sizeof(*mem); } @@ -295,21 +295,20 @@ void writeUserBlock(FlashStruct *mem, int addr, int numbytes) // *** that the main file is valid before backing it up I guess... *** // *** but I don't think this situation should arise. *** - static GMutex mutex; - - g_mutex_lock (&mutex); + static GStaticMutex mutex = G_STATIC_MUTEX_INIT; + g_static_mutex_lock (&mutex); if (!globals.Flags.flash_writes_suspended) { // backup the main copy of the file - if (!globals.Flags.shutdown_started) { + if (!globals.Sys.shutdown_started) { - globals.Flags.flash_write_in_progress = TRUE; + globals.Sys.flash_write_in_progress = TRUE; bool backup_ok = persistence_copyfile(MAINFILE, BACKUPFILE); - globals.Flags.flash_write_in_progress = FALSE; + globals.Sys.flash_write_in_progress = FALSE; - if (backup_ok && !globals.Flags.shutdown_started) { - globals.Flags.flash_write_in_progress = TRUE; + if (backup_ok && !globals.Sys.shutdown_started) { + globals.Sys.flash_write_in_progress = TRUE; if (!persistence_freeze(MAINFILE, mem, addr, numbytes, sizeof(*mem), 0)) { if (errno != PERSIST_ERR_COULDNTWRITE) { @@ -318,14 +317,14 @@ void writeUserBlock(FlashStruct *mem, int addr, int numbytes) printf("Error while writing data to disk. **File is potentially corrupt!**\n"); } } - globals.Flags.flash_write_in_progress = FALSE; + globals.Sys.flash_write_in_progress = FALSE; } else { printf("Could not backup current file. **Write did not happen!!!**\n"); } } } - g_mutex_unlock (&mutex); + g_static_mutex_unlock (&mutex); } @@ -333,9 +332,6 @@ static void initFlashValues(FlashStruct *mem) { int i,j,k,m; float power_of_ten, power_of_two; - float base_number; - - base_number=11; mem->flash_start=1; mem->turn_on_dly=5; @@ -344,9 +340,7 @@ static void initFlashValues(FlashStruct *mem) mem->ChanKey_logic_level=0; strcpy(mem->model_num,"unprogrammed"); - strcpy(mem->serial_num,"no S/N"); - strcpy(mem->password,"default"); - strcpy(mem->username,"admin"); + strcpy(mem->serial_num,"00000"); mem->fully_programmed=Being_Programmed; @@ -358,11 +352,11 @@ static void initFlashValues(FlashStruct *mem) mem->telnet_logon_timeout=30; /* thirty seconds */ mem->baud = 1200; - mem->parity = rs232_parity_none; - mem->stopbits = 1; - mem->databits = 8; + mem->parity = rs232_parity_none; // no longer used + 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; @@ -443,35 +437,34 @@ static void initFlashValues(FlashStruct *mem) temp_int_prf=dac_max; mem->period_pwl_time[i][j][k][m]=(47e-9*power_of_ten)+41e-9; - mem->pw_pwl_time[i][j][k][m]=(base_number*0.7e-9*power_of_ten)+5e-9; - mem->delay_pwl_time[i][j][k][m]=(base_number*0.7e-9*power_of_ten)+7.6e-9; - mem->burst_pwl_time[i][j][k][m]=(2*base_number*1.0e-9*power_of_ten)+25e-9; + mem->pw_pwl_time[i][j][k][m]=(6e-9*power_of_ten)+5e-9; + mem->delay_pwl_time[i][j][k][m]=(6e-9*power_of_ten)+10e-9; + mem->burst_pwl_time[i][j][k][m]=(22e-9*power_of_ten)+25e-9; } else if (m==1) { - temp_int_pw_dly=dac_max/3; + temp_int_pw_dly=dac_max/2.15; temp_int_prf=dac_max/2.15; - mem->period_pwl_time[i][j][k][m]=(1e-7*power_of_ten)+50e-9; - - mem->pw_pwl_time[i][j][k][m]=(3*base_number*0.7e-9*power_of_ten)+10e-9; - mem->delay_pwl_time[i][j][k][m]=(3*base_number*0.7e-9*power_of_ten)+17e-9; - mem->burst_pwl_time[i][j][k][m]=(3*base_number*1.0e-9*power_of_ten)+10e-9; + mem->period_pwl_time[i][j][k][m]=(100e-9*power_of_ten)+50e-9; + mem->pw_pwl_time[i][j][k][m]=(14e-9*power_of_ten)+10e-9; + mem->delay_pwl_time[i][j][k][m]=(14e-9*power_of_ten)+30e-9; + mem->burst_pwl_time[i][j][k][m]=(33e-9*power_of_ten)+10e-9; } else if (m==2) { - temp_int_pw_dly=dac_min; + temp_int_pw_dly=dac_max/4.6; temp_int_prf=dac_max/4.6; - mem->period_pwl_time[i][j][k][m]=(2.3e-7*power_of_ten)+100e-9; - mem->pw_pwl_time[i][j][k][m]=(base_number*0.7e-8*power_of_ten)+40e-9; - mem->delay_pwl_time[i][j][k][m]=(base_number*0.7e-8*power_of_ten)+40e-9; - mem->burst_pwl_time[i][j][k][m]=(base_number*1.0e-8*power_of_ten)+10e-9; + mem->period_pwl_time[i][j][k][m]=(230e-9*power_of_ten)+100e-9; + mem->pw_pwl_time[i][j][k][m]=(28e-9*power_of_ten)+20e-9; + mem->delay_pwl_time[i][j][k][m]=(28e-9*power_of_ten)+60e-9; + mem->burst_pwl_time[i][j][k][m]=(50e-9*power_of_ten)+10e-9; } else if (m==3) { - temp_int_pw_dly=0; + temp_int_pw_dly=dac_min; temp_int_prf=dac_min; - mem->period_pwl_time[i][j][k][m]=(4.7e-7*power_of_ten)+160e-9; - mem->pw_pwl_time[i][j][k][m]=0.0; - mem->delay_pwl_time[i][j][k][m]=0.0; - mem->burst_pwl_time[i][j][k][m]=0.0; + mem->period_pwl_time[i][j][k][m]=(470e-9*power_of_ten)+160e-9; + mem->pw_pwl_time[i][j][k][m]=(70e-9*power_of_ten)+40e-9; + mem->delay_pwl_time[i][j][k][m]=(70e-9*power_of_ten)+90e-9; + mem->burst_pwl_time[i][j][k][m]=(110e-9*power_of_ten)+10e-9; } else { temp_int_pw_dly=0; temp_int_prf=0; @@ -736,6 +729,7 @@ static void initFlashValues(FlashStruct *mem) mem->vcc2_min[i]=3.0; mem->use_high_ampl_ranges_for_high_pw_ranges[i]=0; + mem->couple_first_N_pw_ranges_to_ampl_ranges[i]=0; } mem->relay_delay_in_sec=0.5; |