comparison src/cs/drivers/drv_app/fchg/fchg_struct.h @ 0:4e78acac3d88

src/{condat,cs,gpf,nucleus}: import from Selenite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:23:26 +0000
parents
children 75067af48bfd
comparison
equal deleted inserted replaced
-1:000000000000 0:4e78acac3d88
1 /*
2 * Internal structure definitions for the FCHG SWE reside here.
3 * abb_inth.c will also need to include this header in order to
4 * get our T_PWR_CTRL_BLOCK definition.
5 */
6
7 #ifndef __FCHG_STRUCT_H
8 #define __FCHG_STRUCT_H
9
10 #include "rv/rv_general.h"
11 #include "rvf/rvf_api.h"
12 #include "fchg/fchg_common.h"
13
14 struct charging_config {
15 UINT16 start_delay;
16 UINT16 start_thresh;
17 UINT16 restart_thresh;
18 UINT16 ci2cv_thresh;
19 UINT16 cv_init_set;
20 UINT16 cv_ctrl_loop_high;
21 UINT16 cv_ctrl_loop_low;
22 UINT16 cv_dac_max_incr;
23 UINT16 cv_dac_max_decr;
24 UINT16 cv_samples_needed;
25 UINT16 overvoltage;
26 UINT16 ci_current;
27 UINT16 end_current;
28 UINT16 ichg_max_spike;
29 UINT16 ichg_samples_needed;
30 UINT16 charge_time_limit;
31 UINT16 recharge_delay;
32 UINT16 bciconf;
33 };
34
35 /* from original PWR SWE */
36 typedef struct {
37 UINT16 bat_voltage;
38 T_PWR_PERCENT remain_capa;
39 } T_PWR_THRESHOLDS;
40
41 #define MAX_THRESHOLDS 101
42
43 #define ICHG_AVG_WINDOW 6
44
45 typedef struct {
46 /* RiViera boilerplate */
47 T_RVF_ADDR_ID addr_id;
48 T_RVF_MB_ID prim_id;
49 /* configuration */
50 struct charging_config config;
51 BOOL config_present;
52 T_PWR_THRESHOLDS batt_thresholds[MAX_THRESHOLDS];
53 UINT16 nb_thresholds;
54 /* state */
55 enum fchg_state state;
56 UINT16 batt_mv;
57 UINT16 curr_disch_thresh;
58 /* valid only during a charging cycle */
59 UINT16 i2v_offset;
60 UINT16 cv_dac_init;
61 UINT16 cv_dac_curr;
62 UINT16 cv_high_vbat_count;
63 UINT16 cv_low_vbat_count;
64 UINT16 ichg_avg_buf[ICHG_AVG_WINDOW];
65 UINT16 ichg_fill_level;
66 UINT16 ichg_ring_ptr;
67 UINT16 ichg_average;
68 UINT16 ichg_low_count;
69 UINT32 start_time;
70 } T_PWR_CTRL_BLOCK;
71
72 #endif /* include guard */