FreeCalypso > hg > tcs211-l1-reconst
diff chipsetsw/layer1/cfile/l1_pwmgr.c @ 128:a2f9560c1cf1
l1_pwmgr.c: began de-LoCosto-fication of l1s_sleep_manager()
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Fri, 13 May 2016 19:18:35 +0000 |
parents | 633cc67bebbc |
children | 419f638cf03b |
line wrap: on
line diff
--- a/chipsetsw/layer1/cfile/l1_pwmgr.c Fri May 13 17:21:26 2016 +0000 +++ b/chipsetsw/layer1/cfile/l1_pwmgr.c Fri May 13 19:18:35 2016 +0000 @@ -284,9 +284,9 @@ } -#if (CODE_VERSION!=SIMULATION) +#if 0 /* FreeCalypso TCS211 reconstruction */ T_PWMGR_DEBUG l1_pwmgr_debug; -#endif // NOT SIMULATION +#endif /* FreeCalypso: massive #if (CHIPSET == 15) chunk removed */ @@ -775,10 +775,6 @@ UWORD32 sleep_time = l1s.actual_time.fn; #endif -#if(CHIPSET == 15) - Uint8 sleep_status; -#endif - #if (GSM_IDLE_RAM != 0) T_L1S_GSM_IDLE_INTRAM * gsm_idle_ram_ctl; BOOL flag_traffic_controller_state = 0; @@ -797,19 +793,13 @@ // Power management is enabled WORD32 min_time, OSload, HWtimer,wake_up_time,min_time_gauging; UWORD32 sleep_mode; - #if (ANLG_FAM != 11) WORD32 afc_fix; - #endif UWORD32 uw32_store_next_time; - #if (CHIPSET != 15) static UWORD32 previous_sleep = FRAME_STOP; - #endif #if (W_A_CALYPSO_PLUS_SPR_19599 == 1) BOOL extended_page_mode_state = 0; //Store state of extended page mode #endif - #if (CHIPSET != 15) WORD32 time_from_last_wakeup=0; - #endif #if (OP_BT == 1) WORD32 hci_ll_status; @@ -819,10 +809,28 @@ why_big_sleep = BIG_SLEEP_DUE_TO_UNDEFINED; wakeup_type = WAKEUP_FOR_UNDEFINED; -#if (CHIPSET != 15) time_from_last_wakeup = (sleep_time - last_wakeup + 42432) % 42432; -#endif + + //================================================= + // check System (SIM, UART, LDC ..... ) + //================================================= + sleep_mode = Cust_check_system(); + #if (GSM_IDLE_RAM != 0) + //================================================= + // check System (SIM, UART, LDC ..... ) + //================================================= + gsm_idle_ram_ctl->sleep_mode = sleep_mode; + #endif + + if (sleep_mode == DO_NOT_SLEEP) + { + #if (GSM_IDLE_RAM != 0) + gsm_idle_ram_ctl->os_load = 0; + gsm_idle_ram_ctl->hw_timer = 0; + #endif // GSM_IDLE_RAM + return; + } #if (CODE_VERSION != SIMULATION) //================================================= @@ -836,43 +844,6 @@ //================================================= INT_DisableIRQ(); #endif // NOT SIMULATION - //================================================= - // check System (SIM, UART, LDC ..... ) - //================================================= -#if (CHIPSET == 15) - #if (WCP_PROF == 0) - sleep_mode = Check_Peripheral_App(); /* For Locosto */ - #else - sleep_mode = DO_NOT_SLEEP; //Check_Peripheral_App(); /* For Locosto */ - #endif -#else - sleep_mode = Cust_check_system(); -#endif - - #if (GSM_IDLE_RAM != 0) - //================================================= - // check System (SIM, UART, LDC ..... ) - //================================================= - gsm_idle_ram_ctl->sleep_mode = sleep_mode; - #endif - - if (sleep_mode == DO_NOT_SLEEP) - { - OS_system_Unprotect(); - // free System structure - // Enable all IRQ - //l1_pwmgr_irq_dis_flag = 0; - #if (CODE_VERSION!=SIMULATION) - INT_EnableIRQ(); - l1_trace_fail_sleep(FAIL_SLEEP_PERIPH_CHECK, l1_pwmgr_debug.fail_id, l1_pwmgr_debug.fail_ret_val); - #endif - #if (GSM_IDLE_RAM != 0) - gsm_idle_ram_ctl->os_load = 0; - gsm_idle_ram_ctl->hw_timer = 0; - #endif // GSM_IDLE_RAM - return; - } - #if (OP_L1_STANDALONE == 0) /*GC_Sleep(); OMAPS00134004*/ @@ -881,23 +852,23 @@ // check OS loading //================================================= OSload = OS_get_inactivity_ticks(); - #if (CODE_VERSION!=SIMULATION) - if ((OSload >= 0) && (OSload <= MIN_SLEEP_TIME)){ - l1_pwmgr_debug.fail_id = FAIL_SLEEP_DUE_TO_OSLOAD; - l1_pwmgr_debug.fail_ret_val = OSload; - } - #endif //NOT SIMULATION + #if 0 /* FreeCalypso TCS211 reconstruction */ + if ((OSload >= 0) && (OSload <= MIN_SLEEP_TIME)){ + l1_pwmgr_debug.fail_id = FAIL_SLEEP_DUE_TO_OSLOAD; + l1_pwmgr_debug.fail_ret_val = OSload; + } + #endif //================================================= // check HW Timers loading //================================================= HWtimer= l1s_get_HWTimers_ticks(); - #if (CODE_VERSION!=SIMULATION) - if (HWtimer == 0){ - l1_pwmgr_debug.fail_id = FAIL_SLEEP_DUE_TO_HWTIMER; - l1_pwmgr_debug.fail_ret_val = 0; - } - #endif //NOT SIMULATION + #if 0 /* FreeCalypso TCS211 reconstruction */ + if (HWtimer == 0){ + l1_pwmgr_debug.fail_id = FAIL_SLEEP_DUE_TO_HWTIMER; + l1_pwmgr_debug.fail_ret_val = 0; + } + #endif #if (GSM_IDLE_RAM != 0) //================================================= @@ -922,11 +893,11 @@ #else min_time_gauging = -1; // not used #endif - #if (CODE_VERSION!=SIMULATION) - if (min_time_gauging == 0){ - l1_pwmgr_debug.fail_id = FAIL_SLEEP_DUE_TO_MINTIMEGAUGING; - l1_pwmgr_debug.fail_ret_val = 0; - } + #if 0 /* FreeCalypso TCS211 reconstruction */ + if (min_time_gauging == 0){ + l1_pwmgr_debug.fail_id = FAIL_SLEEP_DUE_TO_MINTIMEGAUGING; + l1_pwmgr_debug.fail_ret_val = 0; + } #endif // NOT SIMULATION @@ -941,9 +912,7 @@ if ( !OSload || !HWtimer || !min_time_gauging - #if (CHIPSET != 15) || ((sleep_mode != CLOCK_STOP) && ((why_big_sleep == BIG_SLEEP_DUE_TO_UART) || (why_big_sleep == BIG_SLEEP_DUE_TO_SIM))) - #endif #if (OP_BT == 1) || !hci_ll_status #endif @@ -975,11 +944,7 @@ } #endif -#if (CHIPSET != 15) SER_WakeUpUarts(); // Wake up Uarts -#else - // To be checked if this needs a change -#endif #if (GSM_IDLE_RAM != 0) // The traffic controller state shall be restored as it was before @@ -992,7 +957,7 @@ flag_traffic_controller_state = 0; #endif #endif - #if (CODE_VERSION!=SIMULATION) + #if 0 /* FreeCalypso TCS211 reconstruction */ l1_trace_fail_sleep(FAIL_SLEEP_OSTIMERGAUGE, l1_pwmgr_debug.fail_id, l1_pwmgr_debug.fail_ret_val); #endif return; @@ -1064,8 +1029,6 @@ l1s.pw_mgr.sleep_performed = FRAME_STOP; - -#if (CHIPSET != 15) if ((previous_sleep == CLOCK_STOP) && (time_from_last_wakeup < 7)) { #if (CODE_VERSION != SIMULATION) @@ -1102,113 +1065,9 @@ #endif // NOT SIMULATION return; } -#else // CHIPSET == 15 - - - if (l1s.pw_mgr.sleep_performed == CLOCK_STOP) - { - - #if (CODE_VERSION != SIMULATION) - UWORD8 local_sleep_status; - - - local_sleep_status = Peripheral_interface[UART_ID](SLEEP_CMD); - sleep_status = local_sleep_status; - if(local_sleep_status == 0) - { - l1_pwmgr_debug.fail_id = UART_ID; - l1_pwmgr_debug.fail_ret_val = sleep_status; - } - - OS_system_Unprotect(); - local_sleep_status = Peripheral_interface[MADC_AS_ID](SLEEP_CMD); /* Call MADC & Stereo Sleep before I2C */ - OS_system_protect(); - sleep_status &= local_sleep_status; - if(local_sleep_status == 0) - { - l1_pwmgr_debug.fail_id = MADC_AS_ID; - l1_pwmgr_debug.fail_ret_val = sleep_status; - } - - local_sleep_status = Peripheral_interface[USB_ID](SLEEP_CMD); - sleep_status &= local_sleep_status; - if(local_sleep_status == 0) - { - l1_pwmgr_debug.fail_id = USB_ID; - l1_pwmgr_debug.fail_ret_val = sleep_status; - } - - local_sleep_status = Peripheral_interface[USIM_ID](SLEEP_CMD); - sleep_status &= local_sleep_status; - if(local_sleep_status == 0) - { - l1_pwmgr_debug.fail_id = USIM_ID; - l1_pwmgr_debug.fail_ret_val = sleep_status; - } - - local_sleep_status = Peripheral_interface[I2C_ID](SLEEP_CMD); - sleep_status &= local_sleep_status; - if(local_sleep_status == 0) - { - l1_pwmgr_debug.fail_id = I2C_ID; - l1_pwmgr_debug.fail_ret_val = sleep_status; - } - - local_sleep_status = Peripheral_interface[LCD_ID](SLEEP_CMD); - sleep_status &= local_sleep_status; - if(local_sleep_status == 0) - { - l1_pwmgr_debug.fail_id = LCD_ID; - l1_pwmgr_debug.fail_ret_val = sleep_status; - } - - local_sleep_status = Peripheral_interface[CAMERA_ID](SLEEP_CMD); - sleep_status &= local_sleep_status; - if(local_sleep_status == 0) - { - l1_pwmgr_debug.fail_id = CAMERA_ID; - l1_pwmgr_debug.fail_ret_val = sleep_status; - } -local_sleep_status = Peripheral_interface[BCI_ID](SLEEP_CMD); - sleep_status &= local_sleep_status; - if(local_sleep_status == 0) - { - l1_pwmgr_debug.fail_id = BCI_ID; - l1_pwmgr_debug.fail_ret_val = sleep_status; - } - - #endif // NOT SIMULATION - if(!sleep_status) - { - - #if (OP_L1_STANDALONE == 0) - /*GC_Wakeup(); OMAPS00134004*/ - #endif - - #if (CODE_VERSION != SIMULATION) - OS_system_Unprotect(); - l1_trace_fail_sleep(FAIL_SLEEP_PERIPH_SLEEP, l1_pwmgr_debug.fail_id, l1_pwmgr_debug.fail_ret_val); - #endif // NOT SIMULATION - local_sleep_status = Peripheral_interface[UART_ID](WAKE_CMD); //OMAPS00090550 - local_sleep_status = Peripheral_interface[USB_ID](WAKE_CMD); //OMAPS00090550 - local_sleep_status = Peripheral_interface[USIM_ID](WAKE_CMD); //OMAPS00090550 - local_sleep_status = Peripheral_interface[I2C_ID](WAKE_CMD);//OMAPS00090550 - local_sleep_status = Peripheral_interface[LCD_ID](WAKE_CMD);//OMAPS00090550 - local_sleep_status = Peripheral_interface[CAMERA_ID](WAKE_CMD);//OMAPS00090550 - local_sleep_status = Peripheral_interface[MADC_AS_ID](WAKE_CMD);//OMAPS00090550 - local_sleep_status = Peripheral_interface[BCI_ID](WAKE_CMD); //wake up for battery charger interface//OMAPS00090550 - INT_EnableIRQ(); - return; - } - } - -#endif // CHIPSET == 15 - -#if (CHIPSET != 15) // update previous sleep previous_sleep = l1s.pw_mgr.sleep_performed; -#endif #if (CODE_VERSION != SIMULATION) @@ -1246,41 +1105,7 @@ { l1ctl_pgm_clk32(DEFAULT_HFMHZ_VALUE*8,DEFAULT_32KHZ_VALUE); } - - #if (CHIPSET == 15) - - - /* These APIs are to be provided by BSP */ - // Disable_APC_BG(); - gpio_sleep(); //LCD_Floating Pin Fix - DBB_Configure_DS(); - - //gpio_sleep(); //LCD_Floating Pin Fix - - #endif - - } - #if (CHIPSET == 15) - else - { - //DBB_Configure_BS(); // Not used - } - #endif - - - #if (CHIPSET == 15) - // The following command writes '0' into CKM_OCPCLK register in DRP; - // This is done before disabling DPLL - // CKM_OCPCLK (R/W) = Address 0xFFFF040C - // Bit 0: 0 ?OCP clock is the DCXO clock. - // 1 ?OCP clock is the divided DSP clock - // Bit 31:1 Not Used - (drp_regs->CKM_OCPCLKL) &= (~(0x1)); - asm(" NOP"); - asm(" NOP"); - #endif - //============================================== @@ -1294,11 +1119,7 @@ //============================================== // if CLOCK_STOP or FRAME-STOP : Asleep OMEGA (ABB) //============================================== - #if (ANLG_FAM != 11) afc_fix = ABB_sleep(l1s.pw_mgr.sleep_performed, l1s.afc); - #else - // Nothing to be done as it should be handled by BSP_TWL3029_Configure_DS/BS - #endif #if (OP_BT == 1) hci_ll_go_to_sleep(); @@ -1307,9 +1128,7 @@ // STop SPI ..... //================================================= - #if(CHIPSET != 15) - *((volatile UWORD16 *)MEM_SPI)&=0xFFFE; // SPI CLK DISABLED - #endif + *((volatile UWORD16 *)MEM_SPI)&=0xFFFE; // SPI CLK DISABLED #endif // NOT SIMULATION @@ -1430,16 +1249,12 @@ //Shut down PERIPHERALS clocks UWIRE and ARMIO if authorized //========================================================== - #if(CHIPSET != 15) - UWORD16 clocks_stopped; //OMAPS90550- new + UWORD16 clocks_stopped; //OMAPS90550- new clocks_stopped = (l1s.pw_mgr.clocks & l1s.pw_mgr.modules_status); if((clocks_stopped & ARMIO_CLK_CUT) == ARMIO_CLK_CUT) *((volatile UWORD16 *)ARMIO_CNTL_REG) &= ~(ARMIO_CLOCKEN); if((clocks_stopped & UWIRE_CLK_CUT) == UWIRE_CLK_CUT) *((volatile UWORD16 *)(MEM_UWIRE + 0x8)) &= ~(0x0001); - #else - // Nothing to be done as it is taken care by Locosto_Configure_BS - #endif #if (W_A_CALYPSO_BUG_01435 == 1) f_arm_sleep_cmd(BIG_SLEEP); @@ -1474,19 +1289,7 @@ #endif - l1s_wakeup(); - - #if (CHIPSET == 15) - // The following command writes '1' into CKM_OCPCLK register in DRP; - // This is done after the DPLL is up - // CKM_OCPCLK (R/W) = Address 0xFFFF040C - // Bit 0: 0 ?OCP clock is the DCXO clock. - // 1 ?OCP clock is the divided DSP clock - // Bit 31:1 Not Used - (drp_regs->CKM_OCPCLKL) |= (0x1); - asm(" NOP"); - asm(" NOP"); - #endif + l1s_wakeup(); last_wakeup = l1s.actual_time.fn_mod42432; @@ -1516,37 +1319,6 @@ // (*(volatile UWORD16 *)l1s_tpu_com.reg_cmd) = TPU_CTRL_CLK_EN; UWORD8 local_sleep_status; - - #if (CHIPSET == 15) - - DBB_Wakeup_DS(); - - gpio_wakeup(); //LCD_Floating Pin Fix - - /* These APIs to be provided by BSP */ - //Enable_APC_BG(); - //BT_Wakeup(); - //IRDA_Wakeup(); - local_sleep_status = Peripheral_interface[UART_ID](WAKE_CMD); //OMAPS00090550 - local_sleep_status = Peripheral_interface[USB_ID](WAKE_CMD);//OMAPS00090550 - local_sleep_status = Peripheral_interface[USIM_ID](WAKE_CMD);//OMAPS00090550 - local_sleep_status = Peripheral_interface[I2C_ID](WAKE_CMD);//OMAPS00090550 - local_sleep_status = Peripheral_interface[LCD_ID](WAKE_CMD);//OMAPS00090550 - local_sleep_status = Peripheral_interface[CAMERA_ID](WAKE_CMD);//OMAPS00090550 - - OS_system_Unprotect(); - local_sleep_status = Peripheral_interface[MADC_AS_ID](WAKE_CMD);//OMAPS00090550 - local_sleep_status = Peripheral_interface[BCI_ID](WAKE_CMD); //wake up for battery charger//OMAPS00090550 - OS_system_protect(); - //added for OMAPS00090550 warning removal - if(local_sleep_status == 0) - { - l1_pwmgr_debug.fail_ret_val = local_sleep_status; - } - //upto this OMAPS00090550 - - - #endif l1dmacro_RF_wakeup(); } @@ -1564,18 +1336,12 @@ //================================================= //if CLOCK_STOP or FRAME-STOP : ReStart SPI //================================================= - #if(CHIPSET != 15) - *((volatile UWORD16 *)MEM_SPI)|=0x0001; // SPI CLK ENABLED - #endif + *((volatile UWORD16 *)MEM_SPI)|=0x0001; // SPI CLK ENABLED //================================================= // Wake up ABB //================================================= - #if (ANLG_FAM != 11) ABB_wakeup(l1s.pw_mgr.sleep_performed, l1s.afc); - #else - // Nothing to be done here as it will be handled by BSP_TWL3029_Wakeup_DS/BS - #endif #if (OP_BT == 1) hci_ll_wake_up(); @@ -1657,12 +1423,7 @@ #endif - -#if (CHIPSET != 15) SER_WakeUpUarts(); // Wake up Uarts -#else - // To be checked if this needs a change -#endif #if (GSM_IDLE_RAM != 0)