# HG changeset patch # User Mychaela Falconia # Date 1512450249 0 # Node ID 919b44c991fc4c1d14297b2d61bf20c9207cd8ac # Parent ab47ade99fa9d29d16bbc5794ca84e15beed8d87 FCHG: reading of battery table from FFS implemented diff -r ab47ade99fa9 -r 919b44c991fc src/cs/drivers/drv_app/fchg/fchg_default_batt.c --- a/src/cs/drivers/drv_app/fchg/fchg_default_batt.c Tue Dec 05 02:16:32 2017 +0000 +++ b/src/cs/drivers/drv_app/fchg/fchg_default_batt.c Tue Dec 05 05:04:09 2017 +0000 @@ -6,6 +6,7 @@ */ #include "fchg/fchg_env.h" +#include "fchg/fchg_func_i.h" #include "rv/rv_general.h" #include diff -r ab47ade99fa9 -r 919b44c991fc src/cs/drivers/drv_app/fchg/fchg_ffs_init.c --- a/src/cs/drivers/drv_app/fchg/fchg_ffs_init.c Tue Dec 05 02:16:32 2017 +0000 +++ b/src/cs/drivers/drv_app/fchg/fchg_ffs_init.c Tue Dec 05 05:04:09 2017 +0000 @@ -4,6 +4,7 @@ */ #include "fchg/fchg_env.h" +#include "fchg/fchg_func_i.h" #include "rv/rv_general.h" #include "rvf/rvf_api.h" #include "ffs/ffs_api.h" @@ -28,3 +29,22 @@ FCHG_USE_ID); } } + +void pwr_load_ffs_batt_table(void) +{ + int rc; + + rc = ffs_file_read("/etc/batterytab", pwr_ctrl->batt_thresholds, + sizeof(pwr_ctrl->batt_thresholds)); + if (rc >= sizeof(T_PWR_THRESHOLDS)) { + pwr_ctrl->nb_thresholds = rc / sizeof(T_PWR_THRESHOLDS); + rvf_send_trace("FCHG: battery table loaded from FFS", 35, + NULL_PARAM, RV_TRACE_LEVEL_DEBUG_HIGH, + FCHG_USE_ID); + } else { + pwr_set_default_batt_table(); + rvf_send_trace("FCHG: using compiled-in default battery table", + 45, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_HIGH, + FCHG_USE_ID); + } +} diff -r ab47ade99fa9 -r 919b44c991fc src/cs/drivers/drv_app/fchg/fchg_func_i.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cs/drivers/drv_app/fchg/fchg_func_i.h Tue Dec 05 05:04:09 2017 +0000 @@ -0,0 +1,12 @@ +/* + * Declarations of internal functions live here. + */ + +#ifndef __FCHG_FUNC_I +#define __FCHG_FUNC_I + +void pwr_load_ffs_batt_table(void); +void pwr_load_ffs_charging_config(void); +void pwr_set_default_batt_table(void); + +#endif /* include guard */