annotate src/cs/drivers/drv_app/fchg/fchg_default_batt.c @ 673:62a5285e014a

Lorekeeping: allow tpudrv-leonardo.lib on Leonardo/Tango Back in 2015 the Mother's idea was to produce a FreeCalypso development board that would be a clone of TI Leonardo, including the original quadband RFFE; one major additional stipulation was that this board needed to be able to run original unmodified TCS211-20070608 firmware with all blobs intact, with only minimal binary patches to main.lib and tpudrv.lib. The necessary patched libs were produced at that time in the tcs211-patches repository. That plan was changed and we produced FCDEV3B instead, with Openmoko's triband RFFE instead of Leonardo quadband, but when FC Magnetite started in 2016, a TPUDRV_blob= provision was still made, allowing the possibility of patching OM's tpudrv.lib for a restored Leonardo RFFE. Now in 2020 we have FC Tango which is essentially a verbatim clone of Leonardo core, including the original quadband RFFE. We have also deblobbed our firmware so much that we have absolutely no real need for a blob version of tpudrv.lib - but I thought it would be neat to put the ancient TPUDRV_blob= mechanism (classic config) to its originally intended use, just for the heck of it.
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 29 May 2020 03:55:36 +0000
parents 919b44c991fc
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
324
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This module provides the default table of battery State-of-Charge
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * thresholds in the absence of a customized table in FFS.
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 *
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * The present default table has been taken from Pirelli's firmware.
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 */
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include "fchg/fchg_env.h"
326
919b44c991fc FCHG: reading of battery table from FFS implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 324
diff changeset
9 #include "fchg/fchg_func_i.h"
324
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include "rv/rv_general.h"
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include <string.h>
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 static const T_PWR_THRESHOLDS default_batt_table[] = {
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 {4170, 100},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 {4120, 95},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 {4070, 90},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 {4030, 85},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 {3964, 80},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 {3930, 75},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 {3900, 70},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 {3882, 65},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 {3847, 60},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 {3805, 55},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 {3786, 50},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 {3771, 45},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 {3759, 40},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 {3750, 35},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 {3745, 30},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 {3737, 25},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 {3719, 20},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 {3688, 15},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 {3663, 10},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 {3539, 5},
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 {3370, 0}
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 };
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 void pwr_set_default_batt_table(void)
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 {
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 memcpy(pwr_ctrl->batt_thresholds, default_batt_table,
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 sizeof default_batt_table);
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 pwr_ctrl->nb_thresholds = sizeof(default_batt_table) /
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 sizeof(T_PWR_THRESHOLDS);
6ab14029931c FCHG: default battery table implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 }