Changeset 3589


Ignore:
Timestamp:
Mar 5, 2013, 6:25:21 AM (21 months ago)
Author:
quozl
Message:

OLPC XO-4 - fix scaling of battery temperature when using .thermal , a regression introduced in r3400. Add a command for testing the low range of the first sensor. Remove some dead code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpu/arm/mmp3/thermal.fth

    r3322 r3589  
    134134; 
    135135 
    136 : ts-watchdog-enable  ( n -- ) 
    137    dup ts@  h# 0400.0d00 or  swap ts!  \ 100.5C 
     136h# 0400.0d00 value ts-watchdog-mask  \ 100.5C 
     137: ts-watchdog-on  ( n -- ) 
     138   dup ts@  ts-watchdog-mask  or  swap ts! 
     139; 
     140 
     141: ts-watchdog-off  ( n -- ) 
     142   dup ts@  ts-watchdog-mask  invert and  swap ts! 
    138143; 
    139144 
     
    141146   ts-clocks 
    142147   0 ts-range-high 
    143    0 ts-watchdog-enable 
    144    \ WDT reset will cause system hang, per errata 472630, 
    145    \ but on XO-4 A2 and XO-4 B1 is detected by EC 
     148   0 ts-watchdog-on 
     149   \ WDT reset causes SoC hang, per errata 472630, on XO-4 A2 and B1, 
     150   \ but is detected and handled by EC 
    146151   1 ts-range-low 
    147152   2 ts-range-low 
    148153   3 0 do  i ts-auto-read  loop 
     154; 
     155 
     156\ for testing, swing our normally highrange sensor back to lowrange 
     157: 0ts-low 
     158   0 ts-watchdog-off 
     159   0 ts-range-low 
    149160; 
    150161 
     
    172183   2 ts@  gc>c  .c.c 
    173184   ." cpu: "  cpu-temperature  .c 
    174    ." battery: "  bat-temp  .c 
     185   ." battery: "  .bat-temp  ." C " 
    175186   pop-base 
    176187; 
     
    212223      then 
    213224   loop cr 
    214    \ dup d# 12 rshift h# 7ff and dup if 4 spaces ." reserved=" . cr else drop then 
    215225   4 spaces dup 8 rshift h# f and ." wdog_tshld=" .tc cr 
    216226   4 spaces dup 4 rshift h# f and ." int_tshld=" .tc cr 
     
    248258   h# 0c20.0000 h# 03.b004 io! \ lowrange, en_wdog, auto_read_en, wdog_tshld 26C 
    249259; 
    250  
    251  
    252 [ifdef] notyet \ FIXME 
    253 : test-thermal 
    254    .thermal cr 
    255  
    256    \ save the threshold set by cforth 
    257    thermal-base 4 + io@ >r 
    258  
    259    \ temporarily set the threshold close to current value 
    260    thermal-base io@  h# 3ff and  8 +  wd-thresh! 
    261  
    262    begin 
    263       (cr .thermal kill-line d# 500 ms key? 
    264    until key drop cr 
    265  
    266    \ restore the threshold 
    267    r> wd-thresh! 
    268    .thermal cr 
    269 ; 
    270 [then] 
    271260 
    272261stand-init: Thermal sensor 
Note: See TracChangeset for help on using the changeset viewer.