changeset 133:e6611ca0d054

l1_pwmgr.c: l1s_recover_HWTimers() reconstructed
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Sat, 14 May 2016 17:07:26 +0000
parents c721b9d301b9
children cedb53c5926d
files chipsetsw/layer1/cfile/l1_pwmgr.c
diffstat 1 files changed, 16 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/chipsetsw/layer1/cfile/l1_pwmgr.c	Sat May 14 16:31:53 2016 +0000
+++ b/chipsetsw/layer1/cfile/l1_pwmgr.c	Sat May 14 17:07:26 2016 +0000
@@ -1668,14 +1668,18 @@
     cntlreg = Dtimer1_Get_cntlreg();
     if ( (cntlreg & D_TIMER_RUN) == D_TIMER_RUN)
     {
-      cntlreg = cntlreg&0x1F;
+      #if 0	/* match TCS211 object */
+        cntlreg = cntlreg&0x1F;
+      #endif
       cntlreg >>= 2;   // take PTV
       cntlreg = 1 << (cntlreg+1);  // compute 2^(PTV+1)
       // convert sleep duration in HWTimers ticks....
       duration = (l1s.pw_mgr.sleep_duration * 4.615 - (DELTA_TIME/32.768)) / (cntlreg * 0.0012308);
-      if (duration < 0.0){
-        duration = 0.0; // This needs to be done for all the timers
-      }
+      #if 0	/* match TCS211 object */
+        if (duration < 0.0){
+          duration = 0.0; // This needs to be done for all the timers
+        }
+      #endif
       timer1 = Dtimer1_ReadValue() - (UWORD16) duration;
 
       Dtimer1_Start(0);
@@ -1686,14 +1690,18 @@
     cntlreg = Dtimer2_Get_cntlreg();
     if ( (cntlreg & D_TIMER_RUN) == D_TIMER_RUN)
     {
-      cntlreg = cntlreg&0x1F;
+      #if 0	/* match TCS211 object */
+        cntlreg = cntlreg&0x1F;
+      #endif
       cntlreg >>= 2;   // take PTV
       cntlreg = 1 << (cntlreg+1);
       // convert sleep duration in HWTimers ticks....
       duration = (l1s.pw_mgr.sleep_duration * 4.615 - (DELTA_TIME/32.768)) / (cntlreg * 0.0012308);
-      if (duration < 0.0){
-        duration = 0.0; // This needs to be done for all the timers
-      }
+      #if 0	/* match TCS211 object */
+        if (duration < 0.0){
+          duration = 0.0; // This needs to be done for all the timers
+        }
+      #endif
       timer2 = Dtimer2_ReadValue() - (UWORD16) duration;
       Dtimer2_Start(0);
       Dtimer2_WriteValue(timer2);