changeset 338:1c711302732a

FCHG: complete enough to attempt linking into fw build
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 14 Dec 2017 22:03:48 +0000
parents 0df0668f8bea
children 2990f590d368
files components/fchg src/cs/drivers/drv_app/fchg/fchg_messages.c src/cs/drivers/drv_app/fchg/fchg_task.c
diffstat 3 files changed, 39 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/components/fchg	Thu Dec 14 21:47:40 2017 +0000
+++ b/components/fchg	Thu Dec 14 22:03:48 2017 +0000
@@ -39,5 +39,6 @@
 cfile_plain $SRCDIR/fchg_default_batt.c
 cfile_plain $SRCDIR/fchg_env.c
 cfile_plain $SRCDIR/fchg_ffs_init.c
+cfile_plain $SRCDIR/fchg_messages.c
 cfile_plain $SRCDIR/fchg_process.c
 cfile_plain $SRCDIR/fchg_task.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cs/drivers/drv_app/fchg/fchg_messages.c	Thu Dec 14 22:03:48 2017 +0000
@@ -0,0 +1,34 @@
+/*
+ * Incoming message dispatch for the FCHG task is implemented here.
+ */
+
+#include "fchg/fchg_env.h"
+#include "fchg/fchg_func_i.h"
+#include "rv/rv_general.h"
+#include "rvf/rvf_api.h"
+#include "rvm/rvm_use_id_list.h"
+
+void pwr_process_message(T_RV_HDR *msg_ptr)
+{
+	switch (msg_ptr->msg_id) {
+	case USER_START_CHARGE_REQ:
+		pwr_charge_start_req();
+		return;
+	case USER_STOP_CHARGE_REQ:
+		pwr_charge_stop_req();
+		return;
+	case PWR_CHARGER_PLUGGED_IND:
+		pwr_charger_plug();
+		return;
+	case PWR_CHARGER_UNPLUGGED_IND:
+		pwr_charger_unplug();
+		return;
+	case PWR_ADC_IND:
+		pwr_process_adc((struct pwr_adc_ind_s *) msg_ptr);
+		return;
+	default:
+		rvf_send_trace("FCHG task: Received an unknown message", 38,
+				NULL_PARAM, RV_TRACE_LEVEL_DEBUG_HIGH,
+				FCHG_USE_ID);
+	}
+}
--- a/src/cs/drivers/drv_app/fchg/fchg_task.c	Thu Dec 14 21:47:40 2017 +0000
+++ b/src/cs/drivers/drv_app/fchg/fchg_task.c	Thu Dec 14 22:03:48 2017 +0000
@@ -46,7 +46,10 @@
 		{
 			/* Read the message in the driver mailbox and delegate action..*/
 			msg_ptr = (T_RV_HDR *) rvf_read_mbox(FCHG_MAILBOX);
-			pwr_process_message(msg_ptr);
+			if (msg_ptr) {
+				pwr_process_message(msg_ptr);
+				rvf_free_buf ((void *) msg_ptr);
+			}
 		}
 
 		/* Timers */