summaryrefslogtreecommitdiff
path: root/software/mpu/src/kernel.c
diff options
context:
space:
mode:
Diffstat (limited to 'software/mpu/src/kernel.c')
-rw-r--r--software/mpu/src/kernel.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/software/mpu/src/kernel.c b/software/mpu/src/kernel.c
new file mode 100644
index 0000000..71ef57f
--- /dev/null
+++ b/software/mpu/src/kernel.c
@@ -0,0 +1,55 @@
+/*
+ * kernel.c
+ *
+ * Created on: 13.09.2011
+ * Author: Roland
+ */
+#include "Types.h"
+#include "FreeRTOS.h"
+#include "queue.h"
+
+#define kernel_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
+#define kernel_TASK_STACK_SIZE ( ( unsigned short ) 32 )
+
+/* Globals */
+xQueueHandle * gpxQueue_Kernel;
+//static xTaskHandle *pkernel_TaskHandle;
+//static Task_Param_t kernel_Param;
+xTaskHandle *pkernel_TaskHandle;
+Task_Param_t kernel_Param;
+
+/*
+ * Wake up other tasks, send them messages telling what to do,
+ * wait for them to have processed the commands or not, maybe
+ * put them to sleep again, ...
+ * */
+static void kernel_Process_Task(void *Param)
+{
+ Message_t Msg;
+
+ while(1)
+ {
+ xQueueReceive( gpxQueue_Kernel, &Msg, portMAX_DELAY );
+ /*TODO: execute desired command of message */
+
+ /*
+ * switch Msg.Sender
+ *
+ * case Sender_Kernel:
+ * yeah, that's myself
+ *
+ */
+ }
+}
+
+Status_t kernel_Init_Kernel(xQueueHandle * pxQueue)
+{
+ kernel_Param.pxQueue = pxQueue;
+
+ xTaskCreate( kernel_Process_Task, (signed char *) "Kernel",
+ kernel_TASK_STACK_SIZE, &kernel_Param,
+ kernel_TASK_PRIORITY, pkernel_TaskHandle );
+
+ /*TODO: check for success and pass it over to caller. */
+ return STATUS_OK;
+}