# HG changeset patch # User Mychaela Falconia # Date 1463245646 0 # Node ID e6611ca0d0545fb836047d12fc9f9a0b541299d6 # Parent c721b9d301b9491d75e1de69439393d910840d12 l1_pwmgr.c: l1s_recover_HWTimers() reconstructed diff -r c721b9d301b9 -r e6611ca0d054 chipsetsw/layer1/cfile/l1_pwmgr.c --- 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);