FreeCalypso > hg > fc-magnetite
comparison src/cs/drivers/drv_app/fchg/fchg_ffs_init.c @ 326:919b44c991fc
FCHG: reading of battery table from FFS implemented
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Tue, 05 Dec 2017 05:04:09 +0000 |
| parents | ab47ade99fa9 |
| children | 8166b0afcf8c |
comparison
equal
deleted
inserted
replaced
| 325:ab47ade99fa9 | 326:919b44c991fc |
|---|---|
| 2 * In this module we implement the loading of the charging config | 2 * In this module we implement the loading of the charging config |
| 3 * and the battery table from FFS. | 3 * and the battery table from FFS. |
| 4 */ | 4 */ |
| 5 | 5 |
| 6 #include "fchg/fchg_env.h" | 6 #include "fchg/fchg_env.h" |
| 7 #include "fchg/fchg_func_i.h" | |
| 7 #include "rv/rv_general.h" | 8 #include "rv/rv_general.h" |
| 8 #include "rvf/rvf_api.h" | 9 #include "rvf/rvf_api.h" |
| 9 #include "ffs/ffs_api.h" | 10 #include "ffs/ffs_api.h" |
| 10 | 11 |
| 11 void pwr_load_ffs_charging_config(void) | 12 void pwr_load_ffs_charging_config(void) |
| 26 "FCHG: no charging config in FFS, will not charge", 48, | 27 "FCHG: no charging config in FFS, will not charge", 48, |
| 27 NULL_PARAM, RV_TRACE_LEVEL_WARNING, | 28 NULL_PARAM, RV_TRACE_LEVEL_WARNING, |
| 28 FCHG_USE_ID); | 29 FCHG_USE_ID); |
| 29 } | 30 } |
| 30 } | 31 } |
| 32 | |
| 33 void pwr_load_ffs_batt_table(void) | |
| 34 { | |
| 35 int rc; | |
| 36 | |
| 37 rc = ffs_file_read("/etc/batterytab", pwr_ctrl->batt_thresholds, | |
| 38 sizeof(pwr_ctrl->batt_thresholds)); | |
| 39 if (rc >= sizeof(T_PWR_THRESHOLDS)) { | |
| 40 pwr_ctrl->nb_thresholds = rc / sizeof(T_PWR_THRESHOLDS); | |
| 41 rvf_send_trace("FCHG: battery table loaded from FFS", 35, | |
| 42 NULL_PARAM, RV_TRACE_LEVEL_DEBUG_HIGH, | |
| 43 FCHG_USE_ID); | |
| 44 } else { | |
| 45 pwr_set_default_batt_table(); | |
| 46 rvf_send_trace("FCHG: using compiled-in default battery table", | |
| 47 45, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_HIGH, | |
| 48 FCHG_USE_ID); | |
| 49 } | |
| 50 } |
