diff src/cs/services/vibr/vibr_task.c @ 294:e17bdedfbf2b

VIBR SWE initial implementation
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 27 Mar 2022 08:46:10 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cs/services/vibr/vibr_task.c	Sun Mar 27 08:46:10 2022 +0000
@@ -0,0 +1,39 @@
+/*
+ * Our VIBR task's core function lives here.
+ */
+
+#include "vibr/vibr_env.h"
+#include "vibr/vibr_func_i.h"
+#include "rv/rv_general.h"
+#include "rvf/rvf_api.h"
+#include "rvm/rvm_use_id_list.h"
+
+T_RV_RET vibr_core(void)
+{	
+	BOOLEAN error_occured = FALSE;
+	T_RV_HDR *msg_ptr;
+
+	/* loop to process messages */
+	while (error_occured == FALSE)
+	{
+		/* Wait for the necessary events (infinite wait for a msg in the mailbox 0). */
+		UINT16 received_event = rvf_wait (0xffff, 0);
+					
+		/* If an event related to mailbox 0 is received, then */
+		if (received_event & RVF_TASK_MBOX_0_EVT_MASK) 
+		{
+			/* Read the message in the driver mailbox and delegate action..*/
+			msg_ptr = (T_RV_HDR *) rvf_read_mbox(VIBR_MAILBOX);
+			if (msg_ptr) {
+				vibr_process_message(msg_ptr);
+				rvf_free_buf ((void *) msg_ptr);
+			}
+		}
+
+		/* Timers */
+		if (received_event & RVF_TIMER_0_EVT_MASK)
+			vibr_handle_timer();
+
+	}	 // end of while
+	return RV_OK;	
+}