diff options
author | Michael J. Chudobiak <mjc@avtechpulse.com> | 2012-08-22 13:21:52 -0400 |
---|---|---|
committer | Michael J. Chudobiak <mjc@avtechpulse.com> | 2012-08-22 13:21:52 -0400 |
commit | f9385de372e46de69f2fdd691d0f7eebe19bef8f (patch) | |
tree | b0380b722ff556793bb28039b24f241a891dde9f /flash.c | |
parent | fc0ac4d9ae743ee855180ccdb8f24a9eeef896cc (diff) |
added support for partial flash resets
Diffstat (limited to 'flash.c')
-rw-r--r-- | flash.c | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -695,8 +695,8 @@ static void initFlashValues(FlashStruct *mem) mem->extended_relay_delay_in_sec=0.5; mem->wait_states_after_sock_init=10000; - /*0123456789012345678901234567890123456789*/ - strcpy(mem->aux_error_message,"incorrect polarity - output disabled."); + /*0123456789012345678901234567890123456789*/ + strcpy(mem->aux_error_message,"PRF too high! Output disabled."); /* default PW DACs */ @@ -735,17 +735,23 @@ static void initFlashValues(FlashStruct *mem) } -void initFlash(FlashStruct *mem) +void initFlash(FlashStruct *mem, int starting_location) { int read_size = readUserBlock(mem); - if ((read_size == 0) || (mem->fully_programmed == Not_Programmed)) { + if ( (read_size == 0) || + (mem->fully_programmed == Not_Programmed) || + ((starting_location > 0) && (starting_location < sizeof(*mem))) ) { // uninitialized device! initFlashValues(mem); // save the default Flash config, for nonvolatile persistence - writeUserBlock(mem, 0, sizeof(*mem)); + writeUserBlock(mem, starting_location, sizeof(*mem) - starting_location); + + if (starting_location > 0) { + readUserBlock(mem); + } } } |