Author: quozl Date: Fri Oct 12 08:28:22 2012 New Revision: 3364 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3364
Log: OLPC - rewrite SPI and EC flash animation scale calculation following review
Modified: cpu/arm/olpc/build-fw.fth cpu/arm/olpc/edi.fth cpu/x86/pc/olpc/gui.fth cpu/x86/pc/olpc/security.fth dev/olpc/spiflash/spiui.fth
Modified: cpu/arm/olpc/build-fw.fth ============================================================================== --- cpu/arm/olpc/build-fw.fth Fri Oct 12 00:55:19 2012 (r3363) +++ cpu/arm/olpc/build-fw.fth Fri Oct 12 08:28:22 2012 (r3364) @@ -853,8 +853,7 @@ ." Skipping EC reflash, not enough power" cr d# 1000 ms else - show-reflash - ['] show-reflash-dot to edi-progress + jots ['] jot to edi-progress update-ec-flash then then
Modified: cpu/arm/olpc/edi.fth ============================================================================== --- cpu/arm/olpc/edi.fth Fri Oct 12 00:55:19 2012 (r3363) +++ cpu/arm/olpc/edi.fth Fri Oct 12 08:28:22 2012 (r3364) @@ -50,7 +50,7 @@ \ end KB9010 stuff...
d# 128 constant /flash-page -defer edi-progress ' drop to edi-progress ( n -- ) +defer edi-progress ' 2drop to edi-progress ( offset size -- )
: edi-cmd,adr ( offset cmd -- ) \ Send command plus 3 address bytes spi-cs-on ( offset cmd ) @@ -195,11 +195,6 @@ wait-flash-busy ( ) ;
-: .edi-progress ( n -- ) - /ec-flash h# 8000 > if 1 else 0 then rshift ( dot# ) - edi-progress ( ) -; - : edi-program-flash ( adr len offset -- ) cr ( adr len offset ) swap 0 ?do ( adr offset ) @@ -208,7 +203,7 @@ dup i + erase-page ( adr offset ) over i + over i + edi-program-page ( adr offset ) then ( adr offset ) - i .edi-progress ( adr offset ) + i /ec-flash edi-progress ( adr offset ) /flash-page +loop ( adr offset ) 2drop ( ) ;
Modified: cpu/x86/pc/olpc/gui.fth ============================================================================== --- cpu/x86/pc/olpc/gui.fth Fri Oct 12 00:55:19 2012 (r3363) +++ cpu/x86/pc/olpc/gui.fth Fri Oct 12 08:28:22 2012 (r3364) @@ -390,9 +390,13 @@ d# 175 d# 790 ?adjust-y to icon-xy " sad" show-icon ;
-d# 834 value bar-y +d# 32 value #dots +d# 820 value bar-y d# 150 value bar-x +d# 1200 d# 26 - value bar-x-last 0 value dot-adr +0 value dot-spacing +0 value last-dot#
: read-dot ( -- ) \ rom: is unavailable during reflash 0 to dot-adr 0 0 to icon-xy ( ) @@ -400,26 +404,34 @@ prep-565 4drop to dot-adr ( ) ;
-: show-reflash ( -- ) \ bottom left corner, chip and progress dots +: jots ( -- ) \ bottom left corner, chip and progress dots d# 25 d# 772 set-icon-xy " spi" show-icon - d# 992 bar-x + bar-y set-icon-xy " yellowdot" show-icon + bar-x-last bar-y set-icon-xy " yellowdot" show-icon read-dot + -1 to last-dot# + bar-x-last bar-x - #dots / to dot-spacing ;
-: show-reflash-dot ( n -- ) \ n to vary h# 0 to h# 8000 - dup h# 400 mod 0= if ( n ) - dot-adr 0= if drop exit then ( n ) - dot-adr swap h# 20 / bar-x + bar-y ( adr x y ) - image-width image-height ( adr x y w h ) - " draw-transparent-rectangle" $call-screen +: jot ( offset size -- ) + dot-adr 0= if 2drop exit then ( offset size ) + #dots swap */ ( dot# ) + dup last-dot# <> if ( dot# ) + dup to last-dot# ( dot# ) + dot-adr swap ( adr dot# ) + dot-spacing * bar-x + bar-y ( adr x y ) + image-width image-height ( adr x y w h ) + " draw-transparent-rectangle" $call-screen ( ) else drop then ;
0 [if] -: test-reflash-dot - page show-reflash t( h# 8000 0 do i show-reflash-dot h# 80 +loop )t +: test-jots-flash \ XO-4 B1 13ms + page jots t( /flash 0 do i /flash jot /flash-page +loop )t +; +: test-jots-ec \ XO-4 B1 3ms + page jots t( /ec-flash 0 do i /ec-flash jot /flash-page +loop )t ; [then]
Modified: cpu/x86/pc/olpc/security.fth ============================================================================== --- cpu/x86/pc/olpc/security.fth Fri Oct 12 00:55:19 2012 (r3363) +++ cpu/x86/pc/olpc/security.fth Fri Oct 12 08:28:22 2012 (r3364) @@ -1006,7 +1006,7 @@
ec-indexed-io-off? if visible - show-reflash + jots ." Restarting to enable SPI FLASH writing." cr d# 3000 ms ec-ixio-reboot @@ -1016,8 +1016,7 @@ \ Latch alternate? flag for next startup alternate? if [char] A h# 82 cmos! then
- show-reflash - ['] show-reflash-dot to spi-progress + jots ['] jot to spi-progress reflash \ Should power-off and reboot show-x " Reflash returned, unexpectedly" .security-failure
Modified: dev/olpc/spiflash/spiui.fth ============================================================================== --- dev/olpc/spiflash/spiui.fth Fri Oct 12 00:55:19 2012 (r3363) +++ dev/olpc/spiflash/spiui.fth Fri Oct 12 08:28:22 2012 (r3364) @@ -8,12 +8,7 @@
h# 4000 constant /chunk \ Convenient sized piece for progress reports
-defer spi-progress ' drop to spi-progress ( n -- ) - -: .progress ( offset -- ) - /flash h# 10.0000 > if 6 else 5 then rshift ( dot# ) - dup spi-progress h# 400 + spi-progress ( ) -; +defer spi-progress ' 2drop to spi-progress ( offset size -- )
: write-flash-range ( adr end-offset start-offset -- ) ." Writing" cr @@ -31,7 +26,7 @@ i flash-erase-block dup /flash-block i flash-write ( adr ) then - i .progress ( adr ) + i /flash spi-progress ( adr ) /flash-block + ( adr' ) /flash-block +loop ( adr ) cr drop ( ) @@ -196,7 +191,7 @@ [then]
\ Don't write the block containing the manufacturing data - mfg-data-offset .progress + mfg-data-offset /flash spi-progress
flash-buf mfg-data-end-offset + /flash mfg-data-end-offset write-flash-range \ Write last part ; @@ -221,7 +216,7 @@ write-firmware verify-firmware then - /flash .progress + /flash dup spi-progress flash-write-disable else .verify-msg