Changeset 3649


Ignore:
Timestamp:
Apr 27, 2013, 7:47:57 AM (2 years ago)
Author:
quozl
Message:

OLPC XO-1.5 - the Valid RAM and Time (VRT) bit in RTC register 0xd can't be trusted on the XO-1.5, so use other means to detect loss of data. This works in most cases, but there is still the possibility of data corruption when the battery is missing or discharged. #12600.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • dev/ds1385r.fth

    r3631 r3649  
    8888   cr 
    8989   then
     90;
     91\ : $?lost  ( flag head$ -- flag )
     92\    2 pick  if  ." RTC amnesia - " type cr  else  2drop  then
     93\ ;
     94: amnesia?  ( -- flag )
     95   0 rtc@ h# 59 >                       \ " seconds" $?lost
     96   2 rtc@ h# 59 >                       \ " minutes" $?lost
     97   or
     98   4 rtc@ h# 23 >                       \ " hours" $?lost
     99   or
     100   6 rtc@ h# 10 =                       \ " day of week" $?lost
     101   or
     102   7 rtc@ dup 0= swap h# 31 > or        \ " day of month" $?lost
     103   or
     104   8 rtc@ dup 0= swap h# 12 > or        \ " month" $?lost
     105   or
     106   9 rtc@ h# 99 >                       \ " year high" $?lost
     107   or
     108   9 rtc@ h# 13 <                       \ " year low" $?lost
     109   or
     110   h# 1a rtc@ h# 20 <>                  \ " century" $?lost
     111   or
     112   d# 10 rtc@ h# 70 and rega-mode h# 70 and <>  \ " divider" $?lost
     113   or
    90114;
    91115: reinit
     
    105129   my-unit  2  " map-in" $call-parent  is rtc-adr
    106130   first-open?  if
     131      amnesia?  if  reinit  then
    107132      rega-mode d# 10 rtc!
    108133      regb-mode d# 11 rtc!
Note: See TracChangeset for help on using the changeset viewer.