From 3ab7176e463268a471eb0e90c8520be4ff15a42f Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 28 May 2013 19:22:38 +0000 Subject: moved old FreeRTOS based MPU Softeware to mpu.old git-svn-id: https://svn.spreadspace.org/mur.sat@768 7de4ea59-55d0-425e-a1af-a3118ea81d4c --- software/mpu/src/kernel.c | 117 ---------------------------------------------- 1 file changed, 117 deletions(-) delete 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 deleted file mode 100644 index f5d04ea..0000000 --- a/software/mpu/src/kernel.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * kernel.c - * - * Created on: 13.09.2011 - * Author: Roland - */ -#include "Types.h" -#include "FreeRTOS.h" -#include "queue.h" -#include "uart.h" - -#define kernel_TASK_PRIORITY ( tskIDLE_PRIORITY + 5 ) -#define kernel_TASK_STACK_SIZE ( ( unsigned short ) 64 ) - -void UARTSend(uint8_t *BufferPtr, uint32_t Length); - -/* Globals */ -#define BUFSIZE 0x40 // fixme: ...is sdefined in hart.h -static Task_Param_t kernel_Param; -extern volatile uint32_t UARTCount; -extern volatile uint8_t UARTBuffer[BUFSIZE]; - -/* - * 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 RcvMsg; - Message_t SndMsg; - portTickType tick; - portCHAR chBufCam[10] = "Seas Cam!"; - portCHAR chBufLSen[10] = "Seas LSe!"; - portCHAR l = 'l'; - - if(NULL == kernel_Param.QueueHandles.hxq_Kernel) - { - return; - } - - tick = xTaskGetTickCount(); - while(1) - { - vTaskDelayUntil(&tick, MS(3)); - - if( xQueueReceive( kernel_Param.QueueHandles.hxq_Kernel, &RcvMsg, MS(5))) - { - /* - * switch Msg.Sender and act accordingly. - */ - switch (RcvMsg.Sender) - { - case Sender_Camera: - { - SndMsg.Sender = Sender_Kernel; - SndMsg.pData = chBufCam; - xQueueSend(kernel_Param.QueueHandles.hxq_Camera, &SndMsg, MS(10)); - break; - } - - case Sender_LightSens: - { - SndMsg.Sender = Sender_Kernel; - SndMsg.pData = chBufLSen; - for(l = 0; l < 8; l ++) - { - UARTBuffer[l*4 +0] = 48+(((uint8_t *)(RcvMsg.pData))[l])%1000 / 100; - UARTBuffer[l*4 +1] = 48+(((uint8_t *)(RcvMsg.pData))[l])%100 / 10; - UARTBuffer[l*4 +2] = 48+(((uint8_t *)(RcvMsg.pData))[l])%10; - UARTBuffer[l*4 +3] = ' '; - } - UARTCount = 34; - UARTBuffer[32] = '\r'; - UARTBuffer[33] = '\n'; - UARTSend( (uint8_t *)UARTBuffer, UARTCount ); -// UARTSend( (uint8_t *)(RcvMsg.pData), 10 ); -// xQueueSend(kernel_Param.QueueHandles.hxq_LightSens, &SndMsg, MS(10)); - break; - } - case Sender_UART: - { - if (UARTBuffer[UARTCount-1] != 'i') - break; - if ( UARTCount != 0 ) - { - LPC_UART->IER = IER_THRE | IER_RLS; /* Disable RBR */ - UARTSend( (uint8_t *)UARTBuffer, UARTCount ); - UARTCount = 0; - LPC_UART->IER = IER_THRE | IER_RLS | IER_RBR; /* Re-enable RBR */ - - l = 'r'; - SndMsg.pData = &l; - - xQueueSend(kernel_Param.QueueHandles.hxq_LightSens, &SndMsg, MS(10)); - } - break; - } - default: {;} - } - } - } -} - -Status_t kernel_Init_Kernel(QH_t hxQueues) -{ -portBASE_TYPE xResult; - - xResult = xTaskCreate( kernel_Process_Task, (signed char *) "Kernel", - kernel_TASK_STACK_SIZE, &kernel_Param, - kernel_TASK_PRIORITY, &(kernel_Param.hxTask_Self) ); - - kernel_Param.QueueHandles = hxQueues; - - /*TODO: check for success and pass it over to caller. */ - return STATUS_OK; -} -- cgit v1.2.3