Changeset 2192


Ignore:
Timestamp:
Apr 27, 2011, 9:14:27 AM (4 years ago)
Author:
quozl
Message:

OLPC XO-1.5 - fs-update, add support for sparse .zd files, undo -r2186
meaning of zblocks: parameter, split card erasure to avoid card
lockup, and show progress during erasure.

SDHCI - erase blocks, wait for card to leave programming state, and
ignore spurious data timeout.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpu/x86/pc/olpc/via/fsupdate.fth

    r2191 r2192  
    99; 
    1010 
    11 0 value #eblocks-written 
     110 value min-eblock# 
     120 value max-eblock# 
     13 
     14: written ( eblock# -- ) 
     15   dup 
     16   max-eblock# max to max-eblock# ( eblock# ) 
     17   min-eblock# min to min-eblock# 
     18; 
    1219 
    1320: ?all-written  ( -- ) 
    14    #eblocks-written #image-eblocks <>  if 
     21   max-eblock# 1+ #image-eblocks <>  if 
    1522      cr 
    1623      red-letters 
    17       ." WARNING: The file specified " #image-eblocks .d 
    18       ." chunks but wrote only " #eblocks-written .d ." chunks" cr 
     24      ." WARNING: The file said highest block " #image-eblocks .d 
     25      ." but wrote only as high as block " max-eblock# .d cr 
     26      black-letters 
     27   then 
     28   min-eblock# 0 <>  if 
     29      cr 
     30      red-letters 
     31      ." WARNING: The file did not write a zero block, " 
     32      ." but wrote only as low as block " min-eblock# .d cr 
    1933      black-letters 
    2034   then 
     
    5367also nand-commands definitions 
    5468 
     69\ some cards do not respond in a reasonable time, 
     70\ some cards lock up and cause a command timeout in get-status, 
     71\ so split the erase into many parts. 
     72: erase-blocks 
     73   [char] ~ emit                        \ visual hint of erase delay 
     74   #image-eblocks /nand-block h# 200 */ ( #blocks ) 
     75   dup d# 16 / swap                     ( /part #blocks ) 
     76   0 do                                 ( /part ) 
     77      i over " erase-blocks" $call-nand 
     78      hdd-led-toggle                    \ visual hint of progress 
     79   dup +loop                            ( /part ) 
     80   drop 
     81   bs emit space bs emit hdd-led-off    \ visual hint remove 
     82; 
     83 
     84\ : erase-blocks 
     85\ 0 #image-eblocks /nand-block h# 200 */ " erase-blocks" $call-nand ; 
     86 
    5587: zblocks:  ( "eblock-size" "#eblocks" ... -- ) 
    5688   hdd-led-toggle 
     
    5890   get-hex# to /nand-block 
    5991   get-hex# to #image-eblocks 
     92   #image-eblocks to min-eblock# 
     93   0 to max-eblock# 
    6094   " size" $call-nand  #image-eblocks /nand-block um*  d< 
    6195   " Image size is larger than output device" ?nand-abort 
    6296   #image-eblocks  show-init 
    63    0 #image-eblocks /nand-block h# 200 */ " erase-blocks" $call-nand 
     97   erase-blocks 
    6498   get-inflater 
    6599   \ Separate the two buffers by enough space for both the compressed 
     
    201235\  then 
    202236 
     237   dup written                              ( eblock# ) 
    203238   show-written                             ( ) 
    204    #eblocks-written 1+ to #eblocks-written  ( ) 
    205239   show-temperature 
    206240   hdd-led-toggle 
  • dev/mmc/sdhci/sdhci.fth

    r2174 r2192  
    285285 
    286286   allow-timeout?  if      ( isr esr ) 
    287       dup 1 =  if  true to timeout?  2drop exit  then 
     287      dup 1 =  over h# 10 = or  if  true to timeout?  2drop exit  then 
    288288   then                    ( isr esr ) 
    289289 
     
    489489 
    4904900 instance value writing? 
    491  
    492 : erase-blocks  ( block# #blocks -- ) \ UNTESTED 
    493    intstat-on 
    494    dup  0=  if  2drop exit  then 
    495    1- bounds        ( last first ) 
    496    h# 201a 0 cmd    ( last )   \ CMD32 - R1 
    497    h# 211a 0 cmd    ( )        \ CMD33 - R1 
    498    0 h# 261b 0 cmd             \ CMD38 - R1b (wait for busy) 
    499    intstat-off 
    500 ; 
    501491 
    502492\ CMD40 is MMC 
     
    10331023 
    10341024: detach-sdio-card  ( -- ) 
     1025; 
     1026 
     1027: erase-blocks  ( block# #blocks -- ) 
     1028   intstat-on 
     1029   dup  0=  if  2drop exit  then 
     1030   1- bounds        ( last first ) 
     1031   h# 201a 0 cmd    ( last )   \ CMD32 - R1 
     1032   h# 211a 0 cmd    ( )        \ CMD33 - R1 
     1033   0 h# 261b 0 cmd             \ CMD38 - R1b (wait for busy) 
     1034   true to writing?                  ( ) 
     1035   true to allow-timeout? 
     1036   false to timeout? 
     1037   wait-write-done  drop 
     1038   false to allow-timeout? 
     1039   intstat-off 
    10351040; 
    10361041 
Note: See TracChangeset for help on using the changeset viewer.