FreeCalypso > hg > fc-tourmaline
annotate src/cs/drivers/drv_app/power/board/power.c @ 303:f76436d19a7a default tip
!GPRS config: fix long-standing AT+COPS chance hanging bug
There has been a long-standing bug in FreeCalypso going back years:
sometimes in the AT command bring-up sequence of an ACI-only MS,
the AT+COPS command would produce only a power scan followed by
cessation of protocol stack activity (only L1 ADC traces), instead
of the expected network search sequence. This behaviour was seen
in different FC firmware versions going back to Citrine, and seemed
to follow some law of chance, not reliably repeatable.
This bug has been tracked down and found to be specific to !GPRS
configuration, stemming from our TCS2/TCS3 hybrid and reconstruction
of !GPRS support that was bitrotten in TCS3.2/LoCosto version.
ACI module psa_mms.c, needed only for !GPRS, was missing in the TCS3
version and had to be pulled from TCS2 - but as it turns out,
there is a new field in the MMR_REG_REQ primitive that needs to be
set correctly, and that psa_mms.c module is the place where this
initialization needed to be added.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 08 Jun 2023 08:23:37 +0000 |
parents | a75eefbf8be4 |
children |
rev | line source |
---|---|
0
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /******************************************************************************* |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * power.c |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * |
211
96c7a4eed1df
.../power/board/power.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
5 * Purpose: This file contains the functions used for power on and off |
0
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 * management of the board. |
211
96c7a4eed1df
.../power/board/power.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
7 * In case of RVM_PWR_SWE, this file contains also the |
96c7a4eed1df
.../power/board/power.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
8 * functions used for charger plug and unplug management. |
0
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 * They are all called after the occurence of the ABB interrupt. |
211
96c7a4eed1df
.../power/board/power.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
10 * |
96c7a4eed1df
.../power/board/power.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
11 * Author: Candice Bazanegue (c-brille@ti.com) |
96c7a4eed1df
.../power/board/power.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
12 * |
213
0947a816580c
first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents:
211
diff
changeset
|
13 * The present FreeCalypso version is heavily modified from TI's original, |
0947a816580c
first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents:
211
diff
changeset
|
14 * for the new FreeCalypso way of managing handset on/off state. |
0
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 * |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 ******************************************************************************/ |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 #ifndef _WINDOWS |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 #include "rv.cfg" |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 #endif |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 #include "abb/abb.h" |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 #include "rvm/rvm_use_id_list.h" |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 #include "spi/spi_env.h" |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 #include "power/power.h" |
281
a75eefbf8be4
Phone boot with PWON: weed out short button presses
Mychaela Falconia <falcon@freecalypso.org>
parents:
263
diff
changeset
|
26 #include "rv/rv_general.h" |
a75eefbf8be4
Phone boot with PWON: weed out short button presses
Mychaela Falconia <falcon@freecalypso.org>
parents:
263
diff
changeset
|
27 #include "rvf/rvf_api.h" |
0
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 #include "rv/rv_defined_swe.h" // for RVM_PWR_SWE |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 #ifndef _WINDOWS |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 #include "kpd/kpd_power_api.h" |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 #include "ffs/ffs.h" |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 #endif // _WINDOWS |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 #ifndef _WINDOWS |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 /* Declare the variable containing pressed and released callback. */ |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 extern T_KPD_KEYPAD Kp; |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 extern effs_t ffs_exit(void); |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 #endif // _WINDOWS |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 |
240
184a031e38e6
Switch_ON(): start FCBM for charging boot mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
42 #if (MMI != 0) |
184a031e38e6
Switch_ON(): start FCBM for charging boot mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
43 #include "fcbm/fcbm_send_msg.h" |
184a031e38e6
Switch_ON(): start FCBM for charging boot mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
44 #endif |
184a031e38e6
Switch_ON(): start FCBM for charging boot mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
45 |
0
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 /// The ABB status used to know the cause of the Switch ON event. |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 static SYS_UWORD16 Power_abb_status = 0; |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 /******************************************************************************* |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 ** |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 ** Function Power_ON_Button |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 ** |
211
96c7a4eed1df
.../power/board/power.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
54 ** Description: Informs the Protocol Stack that the Power ON key has been |
213
0947a816580c
first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents:
211
diff
changeset
|
55 ** pressed, and thus allows it to start. |
0
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 ** |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 *******************************************************************************/ |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 void Power_ON_Button(void) |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 { |
213
0947a816580c
first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents:
211
diff
changeset
|
60 #if (MMI != 0) |
0947a816580c
first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents:
211
diff
changeset
|
61 extern void fchs_pwon_button_boot(void); |
239
305d3bb691a5
FCHG startup: replace fchg_is_running with fchg_first_vbat
Mychaela Falconia <falcon@freecalypso.org>
parents:
223
diff
changeset
|
62 extern int r2d_is_running, mmi_task_init_done; |
305d3bb691a5
FCHG startup: replace fchg_is_running with fchg_first_vbat
Mychaela Falconia <falcon@freecalypso.org>
parents:
223
diff
changeset
|
63 extern UINT16 fchg_first_vbat; |
223
740a8e8fc9d7
startup sync logic rework for the new PWON button boot scheme
Mychaela Falconia <falcon@freecalypso.org>
parents:
213
diff
changeset
|
64 |
239
305d3bb691a5
FCHG startup: replace fchg_is_running with fchg_first_vbat
Mychaela Falconia <falcon@freecalypso.org>
parents:
223
diff
changeset
|
65 while (!fchg_first_vbat || !r2d_is_running || !mmi_task_init_done) |
223
740a8e8fc9d7
startup sync logic rework for the new PWON button boot scheme
Mychaela Falconia <falcon@freecalypso.org>
parents:
213
diff
changeset
|
66 rvf_delay(8); |
0
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 |
281
a75eefbf8be4
Phone boot with PWON: weed out short button presses
Mychaela Falconia <falcon@freecalypso.org>
parents:
263
diff
changeset
|
68 /* |
a75eefbf8be4
Phone boot with PWON: weed out short button presses
Mychaela Falconia <falcon@freecalypso.org>
parents:
263
diff
changeset
|
69 * Is PWON button still held down? If it isn't, we power off. |
a75eefbf8be4
Phone boot with PWON: weed out short button presses
Mychaela Falconia <falcon@freecalypso.org>
parents:
263
diff
changeset
|
70 * We use a raw VRPCDEV write instead of ABB_Power_Off() |
a75eefbf8be4
Phone boot with PWON: weed out short button presses
Mychaela Falconia <falcon@freecalypso.org>
parents:
263
diff
changeset
|
71 * in order to skip the PWON release wait and BZ_KeyBeep_OFF(): |
a75eefbf8be4
Phone boot with PWON: weed out short button presses
Mychaela Falconia <falcon@freecalypso.org>
parents:
263
diff
changeset
|
72 * the off-beep would be very confusing to users in this scenario, |
a75eefbf8be4
Phone boot with PWON: weed out short button presses
Mychaela Falconia <falcon@freecalypso.org>
parents:
263
diff
changeset
|
73 * and we need to skip the PWON release wait so that if the user's |
a75eefbf8be4
Phone boot with PWON: weed out short button presses
Mychaela Falconia <falcon@freecalypso.org>
parents:
263
diff
changeset
|
74 * finger slips but the user really does wish to turn the phone on, |
a75eefbf8be4
Phone boot with PWON: weed out short button presses
Mychaela Falconia <falcon@freecalypso.org>
parents:
263
diff
changeset
|
75 * we won't get stuck in that PWON release wait. |
a75eefbf8be4
Phone boot with PWON: weed out short button presses
Mychaela Falconia <falcon@freecalypso.org>
parents:
263
diff
changeset
|
76 */ |
a75eefbf8be4
Phone boot with PWON: weed out short button presses
Mychaela Falconia <falcon@freecalypso.org>
parents:
263
diff
changeset
|
77 if (ABB_Read_Status() & ONREFLT) { |
a75eefbf8be4
Phone boot with PWON: weed out short button presses
Mychaela Falconia <falcon@freecalypso.org>
parents:
263
diff
changeset
|
78 rvf_send_trace("PWON short press, not accepting", 31, NULL_PARAM, |
a75eefbf8be4
Phone boot with PWON: weed out short button presses
Mychaela Falconia <falcon@freecalypso.org>
parents:
263
diff
changeset
|
79 RV_TRACE_LEVEL_DEBUG_HIGH, LCC_USE_ID); |
a75eefbf8be4
Phone boot with PWON: weed out short button presses
Mychaela Falconia <falcon@freecalypso.org>
parents:
263
diff
changeset
|
80 /* |
a75eefbf8be4
Phone boot with PWON: weed out short button presses
Mychaela Falconia <falcon@freecalypso.org>
parents:
263
diff
changeset
|
81 * Delay so that all trace output up to the last line above |
a75eefbf8be4
Phone boot with PWON: weed out short button presses
Mychaela Falconia <falcon@freecalypso.org>
parents:
263
diff
changeset
|
82 * will be visible in rvtdump or rvinterf for debugging. |
a75eefbf8be4
Phone boot with PWON: weed out short button presses
Mychaela Falconia <falcon@freecalypso.org>
parents:
263
diff
changeset
|
83 */ |
a75eefbf8be4
Phone boot with PWON: weed out short button presses
Mychaela Falconia <falcon@freecalypso.org>
parents:
263
diff
changeset
|
84 rvf_delay(RVF_MS_TO_TICKS(600)); |
a75eefbf8be4
Phone boot with PWON: weed out short button presses
Mychaela Falconia <falcon@freecalypso.org>
parents:
263
diff
changeset
|
85 ABB_Write_Register_on_page(PAGE0, VRPCDEV, 0x0001); |
a75eefbf8be4
Phone boot with PWON: weed out short button presses
Mychaela Falconia <falcon@freecalypso.org>
parents:
263
diff
changeset
|
86 } |
a75eefbf8be4
Phone boot with PWON: weed out short button presses
Mychaela Falconia <falcon@freecalypso.org>
parents:
263
diff
changeset
|
87 |
a75eefbf8be4
Phone boot with PWON: weed out short button presses
Mychaela Falconia <falcon@freecalypso.org>
parents:
263
diff
changeset
|
88 /* proceed with phone boot */ |
213
0947a816580c
first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents:
211
diff
changeset
|
89 fchs_pwon_button_boot(); |
0
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 #endif |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 } |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 /******************************************************************************* |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 ** |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 ** Function Power_OFF_Button |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 ** |
211
96c7a4eed1df
.../power/board/power.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
98 ** Description: Informs the Protocol Stack that the Power OFF key has been |
213
0947a816580c
first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents:
211
diff
changeset
|
99 ** pressed, and thus allows it to stop. |
0
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 ** |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 *******************************************************************************/ |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 void Power_OFF_Button(void) |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 { |
213
0947a816580c
first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents:
211
diff
changeset
|
104 rvf_send_trace("Power off button", 16, NULL_PARAM, RV_TRACE_LEVEL_WARNING, |
0947a816580c
first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents:
211
diff
changeset
|
105 LCC_USE_ID); |
0947a816580c
first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents:
211
diff
changeset
|
106 if (Kp.pressed && Kp.released) { |
0947a816580c
first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents:
211
diff
changeset
|
107 (Kp.pressed)(KPD_PWR); /* tell key is pressed */ |
0947a816580c
first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents:
211
diff
changeset
|
108 rvf_delay(5); |
0947a816580c
first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents:
211
diff
changeset
|
109 (Kp.released)(); /* tell key is released */ |
0947a816580c
first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents:
211
diff
changeset
|
110 } else |
0947a816580c
first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents:
211
diff
changeset
|
111 ABB_Power_Off(); |
0
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 } |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 /** |
213
0947a816580c
first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents:
211
diff
changeset
|
116 * @brief Sets the cause of the switch ON event. |
0
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 * |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 * This function get the ABB status register and stores it into the |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 * global variable Power_abb_status. |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 * |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 * @noparam |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 * |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 * @noreturn |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 */ |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 void Set_Switch_ON_Cause(void) |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 { |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 Power_abb_status = ABB_Read_Status(); |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 } |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 /******************************************************************************* |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 ** |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 ** Function Switch_ON |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 ** |
211
96c7a4eed1df
.../power/board/power.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
135 ** Description This function is called by the spi task after the board is |
0
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 ** switched ON. It calls the appropriate function according |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 ** to the ABB status register. |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 ** |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 ** Warning The Set_Switch_ON_Cause() function has to be called prior. |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 ** |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 *******************************************************************************/ |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 void Switch_ON(void) |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 { |
263
b5e8dfd114a7
Switch_ON(): go into charging boot mode on either CHGSTS or CHGPRES
Mychaela Falconia <falcon@freecalypso.org>
parents:
248
diff
changeset
|
144 if (Power_abb_status & (CHGSTS|CHGPRES)) |
0
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 { |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 /* Switch on Condition on CHARGER IC PLUG */ |
213
0947a816580c
first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents:
211
diff
changeset
|
147 rvf_send_trace("Boot: Charger Plug",18, NULL_PARAM, |
0947a816580c
first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents:
211
diff
changeset
|
148 RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID); |
240
184a031e38e6
Switch_ON(): start FCBM for charging boot mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
149 #if (MMI != 0) |
184a031e38e6
Switch_ON(): start FCBM for charging boot mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
150 fcbm_message_to_task(FCBM_START_CHG_MODE); |
184a031e38e6
Switch_ON(): start FCBM for charging boot mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
239
diff
changeset
|
151 #endif |
0
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 } |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 |
244
96784b8974eb
Switch_ON(): detect charging mode by CHGPRES bit
Mychaela Falconia <falcon@freecalypso.org>
parents:
240
diff
changeset
|
154 else if (Power_abb_status & ONBSTS) |
96784b8974eb
Switch_ON(): detect charging mode by CHGPRES bit
Mychaela Falconia <falcon@freecalypso.org>
parents:
240
diff
changeset
|
155 { |
96784b8974eb
Switch_ON(): detect charging mode by CHGPRES bit
Mychaela Falconia <falcon@freecalypso.org>
parents:
240
diff
changeset
|
156 /* Switch on Condition on ON BUTTON Push */ |
96784b8974eb
Switch_ON(): detect charging mode by CHGPRES bit
Mychaela Falconia <falcon@freecalypso.org>
parents:
240
diff
changeset
|
157 rvf_send_trace("Push Button from OFF to ON",26, NULL_PARAM, |
96784b8974eb
Switch_ON(): detect charging mode by CHGPRES bit
Mychaela Falconia <falcon@freecalypso.org>
parents:
240
diff
changeset
|
158 RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID); |
96784b8974eb
Switch_ON(): detect charging mode by CHGPRES bit
Mychaela Falconia <falcon@freecalypso.org>
parents:
240
diff
changeset
|
159 Power_ON_Button(); |
96784b8974eb
Switch_ON(): detect charging mode by CHGPRES bit
Mychaela Falconia <falcon@freecalypso.org>
parents:
240
diff
changeset
|
160 } |
96784b8974eb
Switch_ON(): detect charging mode by CHGPRES bit
Mychaela Falconia <falcon@freecalypso.org>
parents:
240
diff
changeset
|
161 |
0
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 else |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
163 { |
213
0947a816580c
first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents:
211
diff
changeset
|
164 /* In FreeCalypso start from reset is NOT the same as PWON! */ |
0947a816580c
first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents:
211
diff
changeset
|
165 rvf_send_trace("Start from reset",16, NULL_PARAM, |
0947a816580c
first stage of FreeCalypso handset switch-on logic rework
Mychaela Falconia <falcon@freecalypso.org>
parents:
211
diff
changeset
|
166 RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID); |
248
a5b00817a60f
FCBM reset mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
167 #if (MMI != 0) |
a5b00817a60f
FCBM reset mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
168 fcbm_message_to_task(FCBM_START_RESET_MODE); |
a5b00817a60f
FCBM reset mode implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
244
diff
changeset
|
169 #endif |
0
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
170 } |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
171 } |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
172 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
173 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
174 /******************************************************************************* |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
175 ** |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
176 ** Function Power_ON_Remote |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
177 ** |
211
96c7a4eed1df
.../power/board/power.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
178 ** Description |
0
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
179 ** |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
180 ** |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
181 *******************************************************************************/ |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
182 void Power_ON_Remote(void) |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
183 { |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
184 } |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
185 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
186 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
187 /******************************************************************************* |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
188 ** |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
189 ** Function Power_OFF_Remote |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
190 ** |
211
96c7a4eed1df
.../power/board/power.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
191 ** Description |
0
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
192 ** |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
193 ** |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
194 *******************************************************************************/ |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
195 void Power_OFF_Remote(void) |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
196 { |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
197 } |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
198 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
199 |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
200 /******************************************************************************* |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
201 ** |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
202 ** Function Power_IT_WakeUp |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
203 ** |
211
96c7a4eed1df
.../power/board/power.c: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
0
diff
changeset
|
204 ** Description |
0
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
205 ** |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
206 ** |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
207 *******************************************************************************/ |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
208 void Power_IT_WakeUp(void) |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
209 { |
4e78acac3d88
src/{condat,cs,gpf,nucleus}: import from Selenite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
210 } |