From e94427e2d85dfc409a4f89c263d727dedcdb3a52 Mon Sep 17 00:00:00 2001 From: "Michael J. Chudobiak" Date: Thu, 16 Aug 2012 12:27:50 -0400 Subject: put flash functions in separate files --- globals.c | 45 --------------------------------------------- 1 file changed, 45 deletions(-) (limited to 'globals.c') diff --git a/globals.c b/globals.c index 66007d3..c5ecbc2 100644 --- a/globals.c +++ b/globals.c @@ -5,48 +5,3 @@ GlobalStruct globals = { .error_queue = {0}, .number_of_errors = 0 }; - - -int readUserBlock(void) -{ - // read the flash.copy file into the globals.Flash struct - // and return the number of bytes read in - - // if the file does not exist, then "return 0"; - return 0; -} - -void writeUserBlock(int addr, int numbytes) -{ - // check if flash.copy file exists - // - if it does, update the requested address and - // number of bytes - - // - if does not, create the file and - // set addr = 0, numbytes = sizeof (mem) - // so that entire struct will be written, - // instead of just the requested range - - // All writing should be done in a super-safe - // way. Non-corruption, even during a power-off transient, - // is the priority here. We do not want instruments - // losing configuration data ever, because that - // means expensive repairs. -} - -void initFlash(void) -{ - if (readUserBlock() > 0) return; - - // uninitialized device! - globals.Flash.flash_start = (char) 99; - strcpy(globals.Flash.aux_error_message,"FIXME"); - globals.Flash.channels = (short) 1; - globals.Flash.enable_avrq_extra_ampls = (char) 12; - globals.Flash.ChanKey_frequency = (char) 0; - - // save the default Flash config, for nonvolatile persistence - writeUserBlock(0, sizeof(globals.Flash)); -} - - -- cgit