From: Erik M. <er...@us...> - 2002-01-16 23:19:31
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv1744 Modified Files: flash.c Log Message: Change print_flash_map() in such a way that its body actually doesn't get compiled when BLOB_DEBUG is not defined. Also move it up in the file so we don't get compile-time warnings about undefined functions. Index: flash.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/flash.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- flash.c 2002/01/15 22:52:11 1.12 +++ flash.c 2002/01/16 23:19:27 1.13 @@ -77,6 +77,43 @@ +/* debug function: just print out the flash map and if the blocks are + * locked or not + */ +static void print_flash_map(void) +{ +#ifdef BLOB_DEBUG + int i; + + SerialOutputString("Flash map:\n"); + for(i = 0; i < num_flash_blocks; i++) { + u32 start = flash_blocks[i].start; + + SerialOutputDec(i); + SerialOutputString(":\t0x"); + SerialOutputHex(flash_blocks[i].size); + SerialOutputString(" @ 0x"); + SerialOutputHex(start); + SerialOutputString(" ("); + SerialOutputDec(flash_blocks[i].size / 1024); + SerialOutputString(" kB),\t"); + + if(flash_blocks[i].lockable && + flash_driver->query_block_lock) { + if ((flash_driver->query_block_lock)((u32 *) start)) + SerialOutputString("locked\n"); + else + SerialOutputString("unlocked\n"); + } else { + SerialOutputString("not lockable\n"); + } + } +#endif +} + + + + /* initialise the flash blocks table */ static void init_flash(void) { @@ -142,9 +179,7 @@ i++; } -#ifdef BLOB_DEBUG print_flash_map(); -#endif } @@ -316,36 +351,6 @@ return 0; } - -static void print_flash_map(void) -{ - int i; - - SerialOutputString("Flash map:\n"); - for(i = 0; i < num_flash_blocks; i++) { - u32 start = flash_blocks[i].start; - - SerialOutputDec(i); - SerialOutputString(":\t0x"); - SerialOutputHex(flash_blocks[i].size); - SerialOutputString(" @ 0x"); - SerialOutputHex(start); - SerialOutputString(" ("); - SerialOutputDec(flash_blocks[i].size / 1024); - SerialOutputString(" kB),\t"); - - if(flash_blocks[i].lockable && - flash_driver->query_block_lock) { - if ((flash_driver->query_block_lock)((u32 *) start)) - SerialOutputString("locked"); - else - SerialOutputString("unlocked"); - } else { - SerialOutputString("not lockable"); - } - SerialOutputString("\n"); - } -} /* given an address, return the flash block index number (or negative * error number otherwise |