Changeset 3631


Ignore:
Timestamp:
Mar 28, 2013, 12:57:22 AM (20 months ago)
Author:
quozl
Message:

OLPC - avoid use of RTC undefined data, by detecting power loss and
clearing the RTC count.

XO-1 and XO-1.5 (ds1385): clear all the RTC count registers, not only
the date.

XO-1.75 and XO-4 (ds1338): force the century to 20 like on previous
models, check and clear the oscillator stop flag, clear all the RTC
count registers, separate the clearing of RTC SRAM from the clearing
of RTC count, and fix a regression in r3608 where the wrong register
offsets were used.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpu/arm/olpc/rtc.fth

    r3608 r3631  
    1313headerless 
    1414 
     15: reinit 
     16   h# 20 h#  8 rtc! \ century 
     17   h# 13 h#  6 rtc! \ year 
     18   h#  1 h#  5 rtc! \ month 
     19   h#  1 h#  4 rtc! \ day of month 
     20   h#  2 h#  3 rtc! \ day of week, monday 
     21   h#  0 h#  2 rtc! \ hours 
     22   h#  0 h#  1 rtc! \ minutes 
     23   h#  0 h#  0 rtc! \ seconds 
     24   ." RTC cleared" cr 
     25; 
     26 
    1527: ?clear 
    1628   h# 3f rtc@  h# 3e rtc@  bwjoin  h# 55aa  <>  if 
    17       h# 20 h#  8 rtc!                 \ century 
    18       h# 13 h#  9 rtc!                 \ year 
    19       h#  1 h#  8 rtc!                 \ month 
    20       h#  1 h#  7 rtc!                 \ day 
    2129      h# 20 h# 10  do  0 i rtc!  loop  \ wipe cmos@ cmos! area 
    2230      h# 55aa  wbsplit  h# 3e rtc!  h# 3f rtc! 
     
    4553   then                        ( okay? ) 
    4654 
     55   \ check and clear the oscillator stop flag 
     56   7 rtc@ h# 20 and  if 
     57      reinit 
     58      7 rtc@ h# 20 invert and 7 rtc! 
     59   then 
     60 
    4761   \ manage legacy RTC CMOS usage 
    4862   ?clear 
     
    7084   bcd>  r> bcd>  r> bcd>  r> bcd>  r> bcd>  r> bcd>  r> bcd> ( s m h d m y c ) 
    7185 
     86   d# 20 max 
    7287   d# 100 * +           \ Merge century with year 
    7388; 
  • dev/ds1385r.fth

    r3608 r3631  
    9090; 
    9191: reinit 
    92    h# 20 h# 1a rtc! 
    93    h# 13 h#  9 rtc! 
    94    h#  1 h#  8 rtc! 
    95    h#  1 h#  7 rtc! 
     92   h# 20 h# 1a rtc! \ century 
     93   h# 13 h#  9 rtc! \ year 
     94   h#  1 h#  8 rtc! \ month 
     95   h#  1 h#  7 rtc! \ day of the month 
     96   h#  2 h#  6 rtc! \ day of week, monday 
     97   h#  0 h#  4 rtc! \ hours 
     98   h#  0 h#  2 rtc! \ minutes 
     99   h#  0 h#  0 rtc! \ seconds 
    96100   ." RTC cleared" cr 
    97101; 
     
    138142   bcd>  r> bcd>  r> bcd>  r> bcd>  r> bcd>  r> bcd>  r> bcd> ( s m h d m y c ) 
    139143 
    140    \ We allow the century byte to force the year to 20xx, but not to force 
    141    \ it to 19xx, because that would cause a problem when the century 
    142    \ rolls over. 
    143    dup  d# 20 <>  if 
    144       drop  dup d# 94 <  if  d# 20  else  d# 19  then 
    145    then 
    146  
     144   d# 20 max 
    147145   d# 100 * +           \ Merge century with year 
    148146; 
Note: See TracChangeset for help on using the changeset viewer.