FreeCalypso > hg > fc-magnetite
comparison src/cs/drivers/drv_app/fchg/fchg_ffs_init.c @ 325:ab47ade99fa9
FCHG: reading of charging config from FFS implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 05 Dec 2017 02:16:32 +0000 |
parents | |
children | 919b44c991fc |
comparison
equal
deleted
inserted
replaced
324:6ab14029931c | 325:ab47ade99fa9 |
---|---|
1 /* | |
2 * In this module we implement the loading of the charging config | |
3 * and the battery table from FFS. | |
4 */ | |
5 | |
6 #include "fchg/fchg_env.h" | |
7 #include "rv/rv_general.h" | |
8 #include "rvf/rvf_api.h" | |
9 #include "ffs/ffs_api.h" | |
10 | |
11 void pwr_load_ffs_charging_config(void) | |
12 { | |
13 int rc; | |
14 | |
15 rc = ffs_file_read("/etc/charging", &pwr_ctrl->config, | |
16 sizeof(struct charging_config)); | |
17 if (rc == sizeof(struct charging_config)) { | |
18 pwr_ctrl->config_present = TRUE; | |
19 rvf_send_trace( | |
20 "FCHG: read charging config from FFS, charging enabled", 53, | |
21 NULL_PARAM, RV_TRACE_LEVEL_DEBUG_HIGH, | |
22 FCHG_USE_ID); | |
23 } else { | |
24 pwr_ctrl->config_present = FALSE; | |
25 rvf_send_trace( | |
26 "FCHG: no charging config in FFS, will not charge", 48, | |
27 NULL_PARAM, RV_TRACE_LEVEL_WARNING, | |
28 FCHG_USE_ID); | |
29 } | |
30 } |