view 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
line wrap: on
line source

/*
 * 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);
	}
}