comparison src/cs/drivers/drv_app/power/board/power.c @ 211:96c7a4eed1df

.../power/board/power.c: rm trailing white space
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 22 Apr 2021 20:33:27 +0000
parents 4e78acac3d88
children 0947a816580c
comparison
equal deleted inserted replaced
210:7e225a4cd537 211:96c7a4eed1df
1 /******************************************************************************* 1 /*******************************************************************************
2 * 2 *
3 * power.c 3 * power.c
4 * 4 *
5 * Purpose: This file contains the functions used for power on and off 5 * Purpose: This file contains the functions used for power on and off
6 * management of the board. 6 * management of the board.
7 * In case of RVM_PWR_SWE, this file contains also the 7 * In case of RVM_PWR_SWE, this file contains also the
8 * functions used for charger plug and unplug management. 8 * functions used for charger plug and unplug management.
9 * They are all called after the occurence of the ABB interrupt. 9 * They are all called after the occurence of the ABB interrupt.
10 * 10 *
11 * Author: Candice Bazanegue (c-brille@ti.com) 11 * Author: Candice Bazanegue (c-brille@ti.com)
12 * 12 *
13 * 13 *
14 * (C) Texas Instruments 2001 14 * (C) Texas Instruments 2001
15 * 15 *
16 ******************************************************************************/ 16 ******************************************************************************/
17 17
18 #ifndef _WINDOWS 18 #ifndef _WINDOWS
31 #endif // _WINDOWS 31 #endif // _WINDOWS
32 32
33 #ifdef RVM_PWR_SWE 33 #ifdef RVM_PWR_SWE
34 #include "spi/spi_task.h" 34 #include "spi/spi_task.h"
35 #ifndef _WINDOWS 35 #ifndef _WINDOWS
36 #include "l1sw.cfg" 36 #include "l1sw.cfg"
37 #include "chipset.cfg" 37 #include "chipset.cfg"
38 #endif // _WINDOWS 38 #endif // _WINDOWS
39 #include "pwr/pwr_messages.h" 39 #include "pwr/pwr_messages.h"
40 #include "pwr/pwr_liion_cha.h" 40 #include "pwr/pwr_liion_cha.h"
41 #include "pwr/pwr_disch.h" 41 #include "pwr/pwr_disch.h"
42 #endif /* #ifdef RVM_PWR_SWE */ 42 #endif /* #ifdef RVM_PWR_SWE */
57 57
58 /******************************************************************************* 58 /*******************************************************************************
59 ** 59 **
60 ** Function Power_ON_Button 60 ** Function Power_ON_Button
61 ** 61 **
62 ** Description: Informs the Protocol Stack that the Power ON key has been 62 ** Description: Informs the Protocol Stack that the Power ON key has been
63 ** pressed, and thus allows it to start. 63 ** pressed, and thus allows it to start.
64 ** 64 **
65 *******************************************************************************/ 65 *******************************************************************************/
66 void Power_ON_Button(void) 66 void Power_ON_Button(void)
67 { 67 {
68 #ifndef _WINDOWS 68 #ifndef _WINDOWS
69 SPI_GBL_INFO_PTR->is_gsm_on = TRUE; 69 SPI_GBL_INFO_PTR->is_gsm_on = TRUE;
70 70
71 /* 71 /*
72 When we build for ACI, we have no MMI, so there's no point waiting 72 When we build for ACI, we have no MMI, so there's no point waiting
73 for a keypress. See CR 17958. 73 for a keypress. See CR 17958.
74 */ 74 */
75 75
76 #if (OP_WCP == 0) && (MMI != 0) 76 #if (OP_WCP == 0) && (MMI != 0)
77 77
97 97
98 /******************************************************************************* 98 /*******************************************************************************
99 ** 99 **
100 ** Function Power_OFF_Button 100 ** Function Power_OFF_Button
101 ** 101 **
102 ** Description: Informs the Protocol Stack that the Power OFF key has been 102 ** Description: Informs the Protocol Stack that the Power OFF key has been
103 ** pressed, and thus allows it to stop. 103 ** pressed, and thus allows it to stop.
104 ** 104 **
105 *******************************************************************************/ 105 *******************************************************************************/
106 void Power_OFF_Button(void) 106 void Power_OFF_Button(void)
107 { 107 {
140 140
141 /******************************************************************************* 141 /*******************************************************************************
142 ** 142 **
143 ** Function Switch_ON 143 ** Function Switch_ON
144 ** 144 **
145 ** Description This function is called by the spi task after the board is 145 ** Description This function is called by the spi task after the board is
146 ** switched ON. It calls the appropriate function according 146 ** switched ON. It calls the appropriate function according
147 ** to the ABB status register. 147 ** to the ABB status register.
148 ** 148 **
149 ** Warning The Set_Switch_ON_Cause() function has to be called prior. 149 ** Warning The Set_Switch_ON_Cause() function has to be called prior.
150 ** 150 **
164 pwr_handle_discharge(); 164 pwr_handle_discharge();
165 #endif 165 #endif
166 } 166 }
167 167
168 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2)) 168 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2))
169 else if (Power_abb_status & ONRSTS) 169 else if (Power_abb_status & ONRSTS)
170 #elif (ANLG_FAM == 3) 170 #elif (ANLG_FAM == 3)
171 else if (Power_abb_status & RPSTS) 171 else if (Power_abb_status & RPSTS)
172 #endif 172 #endif
173 { 173 {
174 /* Switch on Condition on ON REM transition 0->1 */ 174 /* Switch on Condition on ON REM transition 0->1 */
175 rvf_send_trace("ON Remote",9, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID); 175 rvf_send_trace("ON Remote",9, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID);
176 Power_ON_Remote(); 176 Power_ON_Remote();
177 #ifdef RVM_PWR_SWE 177 #ifdef RVM_PWR_SWE
178 pwr_handle_discharge(); 178 pwr_handle_discharge();
179 #endif 179 #endif
180 } 180 }
181 181
182 #ifdef RVM_PWR_SWE 182 #ifdef RVM_PWR_SWE
183 else if (Power_abb_status & CHGSTS) 183 else if (Power_abb_status & CHGSTS)
184 { 184 {
185 /* Switch on Condition on CHARGER IC PLUG */ 185 /* Switch on Condition on CHARGER IC PLUG */
186 rvf_send_trace("PWR: Charger Plug",17, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID); 186 rvf_send_trace("PWR: Charger Plug",17, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID);
187 if (Power_abb_status & CHGPRES) 187 if (Power_abb_status & CHGPRES)
188 { 188 {
189 /* charger still present */ 189 /* charger still present */
190 PWR_Charger_Plug(); 190 PWR_Charger_Plug();
191 } 191 }
193 #endif /* #ifdef RVM_PWR_SWE */ 193 #endif /* #ifdef RVM_PWR_SWE */
194 194
195 else 195 else
196 { 196 {
197 // The reset should run the SW in the same way than a Power ON 197 // The reset should run the SW in the same way than a Power ON
198 rvf_send_trace("Start from reset",16, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID); 198 rvf_send_trace("Start from reset",16, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID);
199 Power_ON_Button(); 199 Power_ON_Button();
200 #ifdef RVM_PWR_SWE 200 #ifdef RVM_PWR_SWE
201 pwr_handle_discharge(); 201 pwr_handle_discharge();
202 #endif 202 #endif
203 } 203 }
207 207
208 /******************************************************************************* 208 /*******************************************************************************
209 ** 209 **
210 ** Function Power_ON_Remote 210 ** Function Power_ON_Remote
211 ** 211 **
212 ** Description 212 ** Description
213 ** 213 **
214 ** 214 **
215 *******************************************************************************/ 215 *******************************************************************************/
216 void Power_ON_Remote(void) 216 void Power_ON_Remote(void)
217 { 217 {
221 221
222 /******************************************************************************* 222 /*******************************************************************************
223 ** 223 **
224 ** Function Power_OFF_Remote 224 ** Function Power_OFF_Remote
225 ** 225 **
226 ** Description 226 ** Description
227 ** 227 **
228 ** 228 **
229 *******************************************************************************/ 229 *******************************************************************************/
230 void Power_OFF_Remote(void) 230 void Power_OFF_Remote(void)
231 { 231 {
235 235
236 /******************************************************************************* 236 /*******************************************************************************
237 ** 237 **
238 ** Function Power_IT_WakeUp 238 ** Function Power_IT_WakeUp
239 ** 239 **
240 ** Description 240 ** Description
241 ** 241 **
242 ** 242 **
243 *******************************************************************************/ 243 *******************************************************************************/
244 void Power_IT_WakeUp(void) 244 void Power_IT_WakeUp(void)
245 { 245 {
250 #ifdef RVM_PWR_SWE 250 #ifdef RVM_PWR_SWE
251 /******************************************************************************* 251 /*******************************************************************************
252 ** 252 **
253 ** Function PWR_Charger_Plug 253 ** Function PWR_Charger_Plug
254 ** 254 **
255 ** Description 255 ** Description
256 ** 256 **
257 ** 257 **
258 *******************************************************************************/ 258 *******************************************************************************/
259 void PWR_Charger_Plug(void) 259 void PWR_Charger_Plug(void)
260 { 260 {
283 283
284 /******************************************************************************* 284 /*******************************************************************************
285 ** 285 **
286 ** Function PWR_Charger_Unplug 286 ** Function PWR_Charger_Unplug
287 ** 287 **
288 ** Description 288 ** Description
289 ** 289 **
290 ** 290 **
291 *******************************************************************************/ 291 *******************************************************************************/
292 void PWR_Charger_Unplug(void) 292 void PWR_Charger_Unplug(void)
293 { 293 {
294 /* informs the upper layer that the charger has been unplugged */ 294 /* informs the upper layer that the charger has been unplugged */
295 pwr_send_charger_unplug_event(); 295 pwr_send_charger_unplug_event();
296 296
297 rvf_send_trace("Charger unplug", 14, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID ); 297 rvf_send_trace("Charger unplug", 14, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID );
298 pwr_stop_charging(); 298 pwr_stop_charging();
299 if (SPI_GBL_INFO_PTR->is_gsm_on == FALSE) /* GSM OFF */ 299 if (SPI_GBL_INFO_PTR->is_gsm_on == FALSE) /* GSM OFF */
300 { 300 {
301 #ifndef _WINDOWS 301 #ifndef _WINDOWS
302 #if (ANLG_FAM == 1) 302 #if (ANLG_FAM == 1)
303 ABB_Write_Register_on_page(PAGE0, VRPCCTL2, 0x00EE); 303 ABB_Write_Register_on_page(PAGE0, VRPCCTL2, 0x00EE);
304 #elif ((ANLG_FAM == 2) || (ANLG_FAM == 3)) 304 #elif ((ANLG_FAM == 2) || (ANLG_FAM == 3))
305 ABB_Write_Register_on_page(PAGE0, VRPCDEV, 0x0001); 305 ABB_Write_Register_on_page(PAGE0, VRPCDEV, 0x0001);
306 #endif 306 #endif
307 #else 307 #else