comparison src/cs/layer1/cust0/l1_cust.c @ 343:e0b27310e6ba

l1_cust.c: big sleep when charging with FCHG
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 15 Dec 2017 19:13:22 +0000
parents dd3c89e9ca2e
children 9e0608dc9170
comparison
equal deleted inserted replaced
342:a9743c1dbe58 343:e0b27310e6ba
79 #endif 79 #endif
80 80
81 #if (RF==2) 81 #if (RF==2)
82 #include "l1_rf2.h" 82 #include "l1_rf2.h"
83 #include "l1_rf2.c" 83 #include "l1_rf2.c"
84 #endif
85
86 #include "rv/rv_defined_swe.h" // for RVM_FCHG_SWE
87 #ifdef RVM_FCHG_SWE
88 #include "fchg/fchg_struct.h"
84 #endif 89 #endif
85 90
86 // Nucleus functions 91 // Nucleus functions
87 extern INT TMD_Timer_State; 92 extern INT TMD_Timer_State;
88 extern UWORD32 TMD_Timer; // for big sleep 93 extern UWORD32 TMD_Timer; // for big sleep
244 /* DO_NOT_SLEEP, FRAME_STOP or CLOCK_STOP */ 249 /* DO_NOT_SLEEP, FRAME_STOP or CLOCK_STOP */
245 /*-------------------------------------------------------*/ 250 /*-------------------------------------------------------*/
246 UWORD8 Cust_check_system(void) 251 UWORD8 Cust_check_system(void)
247 { 252 {
248 extern UWORD8 why_big_sleep; 253 extern UWORD8 why_big_sleep;
254 #ifdef RVM_FCHG_SWE
255 extern T_PWR_CTRL_BLOCK *pwr_ctrl;
256 #endif
257
249 #if (CODE_VERSION != SIMULATION) 258 #if (CODE_VERSION != SIMULATION)
250 #if (L2_L3_SIMUL == 0) 259 #if (L2_L3_SIMUL == 0)
251 // Forbid deep sleep if the light is on 260
261 #ifdef RVM_FCHG_SWE
262 // Forbig deep sleep when charging
263 if (pwr_ctrl && pwr_ctrl->state >= FCHG_STATE_I2V_CAL_1 &&
264 pwr_ctrl->state <= FCHG_STATE_CV_CHARGING)
265 {
266 //cut ARMIO and UWIRE clocks in big sleep
267 l1s.pw_mgr.modules_status = ARMIO_CLK_CUT | UWIRE_CLK_CUT ;
268 why_big_sleep = BIG_SLEEP_DUE_TO_CHARGING;
269 return(FRAME_STOP); // BIG sleep
270 }
271 #endif
272
273 // Forbid deep sleep if the light is on
252 if(LT_Status()) 274 if(LT_Status())
253 { 275 {
254 //cut ARMIO and UWIRE clocks in big sleep 276 //cut ARMIO and UWIRE clocks in big sleep
255 l1s.pw_mgr.modules_status = ARMIO_CLK_CUT | UWIRE_CLK_CUT ; 277 l1s.pw_mgr.modules_status = ARMIO_CLK_CUT | UWIRE_CLK_CUT ;
256 why_big_sleep = BIG_SLEEP_DUE_TO_LIGHT_ON; 278 why_big_sleep = BIG_SLEEP_DUE_TO_LIGHT_ON;
257 return(FRAME_STOP); // BIG sleep 279 return(FRAME_STOP); // BIG sleep
258 } 280 }
259 281
260 // Forbid deep sleep if the SIM and UARTs not ready 282 // Forbid deep sleep if the SIM and UARTs not ready
261 if(SIM_SleepStatus()) 283 if(SIM_SleepStatus())
262 { 284 {
263 #endif 285 #endif
264 if(SER_UartSleepStatus()) 286 if(SER_UartSleepStatus())
265 { 287 {