Author: wmb
Date: 2007-08-17 03:02:12 +0200 (Fri, 17 Aug 2007)
New Revision: 557
Modified:
cpu/x86/pc/olpc/copynand.fth
cpu/x86/pc/olpc/nandstat.fth
dev/olpc/cafenand/badblock.fth
Log:
copy-nand - added graphical display of bad-block-table location,
fixed a bug in verify-nand and crc-nand (they were stuck on block 0).
Modified: cpu/x86/pc/olpc/copynand.fth
===================================================================
--- cpu/x86/pc/olpc/copynand.fth 2007-08-16 22:14:47 UTC (rev 556)
+++ cpu/x86/pc/olpc/copynand.fth 2007-08-17 01:02:12 UTC (rev 557)
@@ -137,19 +137,20 @@
: (show-erasing) ( #blocks -- ) ." Erasing " . ." blocks" cr ;
' (show-erasing) is show-erasing
-defer show-erased
+defer show-erased ( block# -- )
: (show-erased) ( block# -- ) (cr . ;
' (show-erased) is show-erased
-defer show-bad
-: (show-bad) ( block# -- ) drop ;
-' (show-bad) is show-bad
+defer show-bad ( block# -- )
+' drop is show-bad
-defer show-clean
-: (show-clean) ( block# -- ) drop ;
-' (show-clean) is show-clean
+defer show-bbt ( block# -- )
+' drop is show-bbt
-defer show-cleaning
+defer show-clean ( block# -- )
+' drop is show-clean
+
+defer show-cleaning ( -- )
: (show-cleaning) ( -- ) cr ." Cleanmarkers" cr ;
' (show-cleaning) is show-cleaning
@@ -170,7 +171,7 @@
['] noop to show-progress
#nand-pages nand-pages/block / show-erasing
- ['] show-bad ['] show-erased " (wipe)" $call-nand
+ ['] show-bad ['] show-erased ['] show-bbt " (wipe)" $call-nand
#image-eblocks show-writing
@@ -205,7 +206,7 @@
" scan-page#" $call-nand .x cr ( )
?key-stop
then ( )
- repeat ( )
+ loop ( )
close-nand-ihs
;
@@ -251,7 +252,7 @@
else ( actual-crc expected-crc )
2drop ( )
then ( )
- repeat ( )
+ loop ( )
close-nand-ihs
;
Modified: cpu/x86/pc/olpc/nandstat.fth
===================================================================
--- cpu/x86/pc/olpc/nandstat.fth 2007-08-16 22:14:47 UTC (rev 556)
+++ cpu/x86/pc/olpc/nandstat.fth 2007-08-17 01:02:12 UTC (rev 557)
@@ -38,12 +38,12 @@
drop
;
-: gshow-erased ( eblock# -- ) 0 0 0 rgb>565 show-state ;
+: gshow-erased ( eblock# -- ) 0 0 0 rgb>565 show-state ;
+: gshow-bad ( eblock# -- ) h# ff 0 0 rgb>565 show-state ;
+: gshow-bbt ( eblock# -- ) h# 80 80 0 rgb>565 show-state ;
+: gshow-clean ( eblock# -- ) h# 0 0 ff rgb>565 show-state ;
-: gshow-bad ( eblock# -- ) h# ff 0 0 rgb>565 show-state ;
-
: gshow-cleaning ( -- ) ." Cleanmarkers" cr cursor-on ;
-: gshow-clean ( eblock# -- ) h# 0 0 ff rgb>565 show-state ;
: gshow-writing ( #eblocks -- )
." Writing "
@@ -66,6 +66,7 @@
['] gshow-erasing to show-erasing
['] gshow-erased to show-erased
['] gshow-bad to show-bad
+ ['] gshow-bbt to show-bbt
['] gshow-clean to show-clean
['] gshow-cleaning to show-cleaning
['] gshow-writing to show-writing
Modified: dev/olpc/cafenand/badblock.fth
===================================================================
--- dev/olpc/cafenand/badblock.fth 2007-08-16 22:14:47 UTC (rev 556)
+++ dev/olpc/cafenand/badblock.fth 2007-08-17 01:02:12 UTC (rev 557)
@@ -297,26 +297,30 @@
: .bn ( -- ) (cr . ;
-: (wipe) ( 'show-bad 'show-erased -- )
+: (wipe) ( 'show-bad 'show-erased 'show-bbt -- )
get-existing-bbt
- bbt if
- usable-page-limit 0 ?do ( 'show-bad 'show-erased )
- i block-bad? if
- i pages/eblock / 2 pick execute
- else
- i pages/eblock / over execute
- i erase-block
- then
- pages/eblock +loop ( 'show-bad 'show-erased )
- 2drop exit
- then ( 'show-bad 'show-erased )
- \ If there is no existing bad block table, make one from factory info
- make-bbt
- 2drop
+ bbt 0= if
+ \ If there is no existing bad block table, make one from factory info
+ make-bbt
+ then ( 'show-bad 'show-erased 'show-bbt )
+
+ bbt0 if bbt0 pages/eblock / over execute then
+ bbt1 if bbt1 pages/eblock / over execute then
+ drop ( 'show-bad 'show-erased )
+
+ usable-page-limit 0 ?do ( 'show-bad 'show-erased )
+ i block-bad? if
+ i pages/eblock / 2 pick execute
+ else
+ i pages/eblock / over execute
+ i erase-block
+ then
+ pages/eblock +loop ( 'show-bad 'show-erased )
+ 2drop exit
;
\ Clear the device but honor the existing bad block table
-: wipe ( -- ) ['] drop ['] .bn (wipe) ;
+: wipe ( -- ) ['] drop ['] .bn ['] drop (wipe) ;
: show-bbt ( -- )
get-bbt