From 365f6599a91f6b2ca8f22c08f62fb6c46ee098b1 Mon Sep 17 00:00:00 2001 From: Roland Sahlsten Date: Tue, 27 Sep 2011 19:50:31 +0000 Subject: Initial version of MPU git-svn-id: https://svn.spreadspace.org/mur.sat@172 7de4ea59-55d0-425e-a1af-a3118ea81d4c --- software/mpu/src/kernel.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 software/mpu/src/kernel.c (limited to 'software/mpu/src/kernel.c') 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; +} -- cgit v1.2.3