# HG changeset patch # User Mychaela Falconia # Date 1512440192 0 # Node ID ab47ade99fa9d29d16bbc5794ca84e15beed8d87 # Parent 6ab14029931c4587ef8c69486fc8ca4498bcf8de FCHG: reading of charging config from FFS implemented diff -r 6ab14029931c -r ab47ade99fa9 components/fchg --- a/components/fchg Tue Dec 05 01:29:04 2017 +0000 +++ b/components/fchg Tue Dec 05 02:16:32 2017 +0000 @@ -37,3 +37,4 @@ cfile_plain $SRCDIR/fchg_default_batt.c cfile_plain $SRCDIR/fchg_env.c +cfile_plain $SRCDIR/fchg_ffs_init.c diff -r 6ab14029931c -r ab47ade99fa9 src/cs/drivers/drv_app/fchg/fchg_env.c --- a/src/cs/drivers/drv_app/fchg/fchg_env.c Tue Dec 05 01:29:04 2017 +0000 +++ b/src/cs/drivers/drv_app/fchg/fchg_env.c Tue Dec 05 02:16:32 2017 +0000 @@ -5,6 +5,7 @@ #include "fchg/fchg_env.h" #include "rv/rv_general.h" +#include "rvf/rvf_api.h" #include "rvm/rvm_priorities.h" #include "rvm/rvm_api.h" #include "rvm/rvm_use_id_list.h" diff -r 6ab14029931c -r ab47ade99fa9 src/cs/drivers/drv_app/fchg/fchg_ffs_init.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cs/drivers/drv_app/fchg/fchg_ffs_init.c Tue Dec 05 02:16:32 2017 +0000 @@ -0,0 +1,30 @@ +/* + * In this module we implement the loading of the charging config + * and the battery table from FFS. + */ + +#include "fchg/fchg_env.h" +#include "rv/rv_general.h" +#include "rvf/rvf_api.h" +#include "ffs/ffs_api.h" + +void pwr_load_ffs_charging_config(void) +{ + int rc; + + rc = ffs_file_read("/etc/charging", &pwr_ctrl->config, + sizeof(struct charging_config)); + if (rc == sizeof(struct charging_config)) { + pwr_ctrl->config_present = TRUE; + rvf_send_trace( + "FCHG: read charging config from FFS, charging enabled", 53, + NULL_PARAM, RV_TRACE_LEVEL_DEBUG_HIGH, + FCHG_USE_ID); + } else { + pwr_ctrl->config_present = FALSE; + rvf_send_trace( + "FCHG: no charging config in FFS, will not charge", 48, + NULL_PARAM, RV_TRACE_LEVEL_WARNING, + FCHG_USE_ID); + } +}