+++ /dev/null
-/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
-\r
- This file is part of the FreeRTOS.org distribution.\r
-\r
- FreeRTOS.org is free software; you can redistribute it and/or modify\r
- it under the terms of the GNU General Public License as published by\r
- the Free Software Foundation; either version 2 of the License, or\r
- (at your option) any later version.\r
-\r
- FreeRTOS.org is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with FreeRTOS.org; if not, write to the Free Software\r
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
-\r
- A special exception to the GPL can be applied should you wish to distribute\r
- a combined work that includes FreeRTOS.org, without being obliged to provide\r
- the source code for any proprietary components. See the licensing section \r
- of http://www.FreeRTOS.org for full details of how and when the exception\r
- can be applied.\r
-\r
- ***************************************************************************\r
- See http://www.FreeRTOS.org for documentation, latest information, license \r
- and contact details. Please ensure to read the configuration and relevant \r
- port sections of the online documentation.\r
-\r
- Also see http://www.SafeRTOS.com for an IEC 61508 compliant version along\r
- with commercial development and support options.\r
- ***************************************************************************\r
-*/\r
-\r
-#ifndef PORT_ASM_H\r
-#define PORT_ASM_H\r
-\r
-typedef void tskTCB;\r
-extern volatile tskTCB * volatile pxCurrentTCB;\r
-extern void vTaskSwitchContext( void );\r
-\r
-/*\r
- * Saves the stack pointer for one task into its TCB, calls\r
- * vTaskSwitchContext() to update the TCB being used, then restores the stack\r
- * from the new TCB read to run the task.\r
- */\r
-void portSWITCH_CONTEXT( void );\r
-\r
-/*\r
- * Load the stack pointer from the TCB of the task which is going to be first\r
- * to execute. Then force an IRET so the registers and IP are popped off the\r
- * stack.\r
- */\r
-void portFIRST_CONTEXT( void );\r
-\r
-#define portSWITCH_CONTEXT() \\r
- asm { mov bx, [pxCurrentTCB] } \\r
- asm { mov word ptr [bx], sp } \\r
- asm { call far ptr vTaskSwitchContext } \\r
- asm { mov bx, [pxCurrentTCB] } \\r
- asm { mov sp, [bx] }\r
-\r
-#define portFIRST_CONTEXT() \\r
- asm { mov bx, [pxCurrentTCB] } \\r
- asm { mov sp, [bx] } \\r
- asm { pop bp } \\r
- asm { pop di } \\r
- asm { pop si } \\r
- asm { pop ds } \\r
- asm { pop es } \\r
- asm { pop dx } \\r
- asm { pop cx } \\r
- asm { pop bx } \\r
- asm { pop ax } \\r
- asm { iret }\r
-\r
-\r
-#endif\r
+++ /dev/null
-/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
-\r
- This file is part of the FreeRTOS.org distribution.\r
-\r
- FreeRTOS.org is free software; you can redistribute it and/or modify\r
- it under the terms of the GNU General Public License as published by\r
- the Free Software Foundation; either version 2 of the License, or\r
- (at your option) any later version.\r
-\r
- FreeRTOS.org is distributed in the hope that it will be useful,\r
- but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- GNU General Public License for more details.\r
-\r
- You should have received a copy of the GNU General Public License\r
- along with FreeRTOS.org; if not, write to the Free Software\r
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
-\r
- A special exception to the GPL can be applied should you wish to distribute\r
- a combined work that includes FreeRTOS.org, without being obliged to provide\r
- the source code for any proprietary components. See the licensing section\r
- of http://www.FreeRTOS.org for full details of how and when the exception\r
- can be applied.\r
-\r
- ***************************************************************************\r
- See http://www.FreeRTOS.org for documentation, latest information, license\r
- and contact details. Please ensure to read the configuration and relevant\r
- port sections of the online documentation.\r
-\r
- Also see http://www.SafeRTOS.com for an IEC 61508 compliant version along\r
- with commercial development and support options.\r
- ***************************************************************************\r
-*/\r
-\r
-\r
-/*-----------------------------------------------------------\r
- * Implementation of functions defined in portable.h for the Tern EE 186\r
- * port.\r
- *----------------------------------------------------------*/\r
-\r
-/* Library includes. */\r
-#include <embedded.h>\r
-#include <ae.h>\r
-\r
-/* Scheduler includes. */\r
-#include "FreeRTOS.h"\r
-#include "task.h"\r
-#include "portasm.h"\r
-\r
-/* The timer increments every four clocks, hence the divide by 4. */\r
-#define portPRESCALE_VALUE ( 16 )\r
-#define portTIMER_COMPARE ( configCPU_CLOCK_HZ / ( configTICK_RATE_HZ * 4UL ) )\r
-\r
-/* From the RDC data sheet. */\r
-#define portENABLE_TIMER_AND_INTERRUPT ( unsigned portSHORT ) 0xe00b\r
-#define portENABLE_TIMER ( unsigned portSHORT ) 0xC001\r
-\r
-/* Interrupt control. */\r
-#define portEIO_REGISTER 0xff22\r
-#define portCLEAR_INTERRUPT 0x0008\r
-\r
-/* Setup the hardware to generate the required tick frequency. */\r
-static void prvSetupTimerInterrupt( void );\r
-\r
-/* The ISR used depends on whether the preemptive or cooperative scheduler\r
-is being used. */\r
-#if( configUSE_PREEMPTION == 1 )\r
- /* Tick service routine used by the scheduler when preemptive scheduling is\r
- being used. */\r
- static void __interrupt __far prvPreemptiveTick( void );\r
-#else\r
- /* Tick service routine used by the scheduler when cooperative scheduling is\r
- being used. */\r
- static void __interrupt __far prvNonPreemptiveTick( void );\r
-#endif\r
-\r
-/* Trap routine used by taskYIELD() to manually cause a context switch. */\r
-static void __interrupt __far prvYieldProcessor( void );\r
-\r
-/*-----------------------------------------------------------*/\r
-/* See header file for description. */\r
-portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )\r
-{\r
-portSTACK_TYPE DS_Reg = 0;\r
-\r
- /* We need the true data segment. */\r
- __asm{ MOV DS_Reg, DS };\r
-\r
- /* Place a few bytes of known values on the bottom of the stack.\r
- This is just useful for debugging. */\r
-\r
- *pxTopOfStack = 0x1111;\r
- pxTopOfStack--;\r
- *pxTopOfStack = 0x2222;\r
- pxTopOfStack--;\r
- *pxTopOfStack = 0x3333;\r
- pxTopOfStack--;\r
-\r
- /* We are going to start the scheduler using a return from interrupt\r
- instruction to load the program counter, so first there would be the\r
- function call with parameters preamble. */\r
- \r
- *pxTopOfStack = FP_OFF( pvParameters );\r
- pxTopOfStack--;\r
- *pxTopOfStack = FP_OFF( pxCode );\r
- pxTopOfStack--;\r
-\r
- /* Next the status register and interrupt return address. */\r
- *pxTopOfStack = portINITIAL_SW;\r
- pxTopOfStack--;\r
- *pxTopOfStack = FP_SEG( pxCode );\r
- pxTopOfStack--;\r
- *pxTopOfStack = FP_OFF( pxCode );\r
- pxTopOfStack--;\r
-\r
- /* The remaining registers would be pushed on the stack by our context\r
- switch function. These are loaded with values simply to make debugging\r
- easier. */\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0xAAAA; /* AX */\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0xBBBB; /* BX */\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0xCCCC; /* CX */\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0xDDDD; /* DX */\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0xEEEE; /* ES */\r
- pxTopOfStack--;\r
-\r
- *pxTopOfStack = DS_Reg; /* DS */\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0x0123; /* SI */\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0xDDDD; /* DI */\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0xBBBB; /* BP */\r
-\r
- return pxTopOfStack;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-portBASE_TYPE xPortStartScheduler( void )\r
-{\r
- /* This is called with interrupts already disabled. */\r
-\r
- /* Put our manual switch (yield) function on a known\r
- vector. */\r
- setvect( portSWITCH_INT_NUMBER, prvYieldProcessor );\r
-\r
- /* Setup the tick interrupt. */\r
- prvSetupTimerInterrupt();\r
-\r
- /* Kick off the scheduler by setting up the context of the first task. */\r
- portFIRST_CONTEXT();\r
-\r
- /* Should not get here! */\r
- return pdFALSE;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-/* The ISR used depends on whether the preemptive or cooperative scheduler\r
-is being used. */\r
-#if( configUSE_PREEMPTION == 1 )\r
- static void __interrupt __far prvPreemptiveTick( void )\r
- {\r
- /* Get the scheduler to update the task states following the tick. */\r
- vTaskIncrementTick();\r
-\r
- /* Switch in the context of the next task to be run. */\r
- portEND_SWITCHING_ISR();\r
-\r
- /* Reset interrupt. */\r
- outport( portEIO_REGISTER, portCLEAR_INTERRUPT );\r
- }\r
-#else\r
- static void __interrupt __far prvNonPreemptiveTick( void )\r
- {\r
- /* Same as preemptive tick, but the cooperative scheduler is being used\r
- so we don't have to switch in the context of the next task. */\r
- vTaskIncrementTick();\r
- /* Reset interrupt. */\r
- outport( portEIO_REGISTER, portCLEAR_INTERRUPT );\r
- }\r
-#endif\r
-/*-----------------------------------------------------------*/\r
-\r
-static void __interrupt __far prvYieldProcessor( void )\r
-{\r
- /* Switch in the context of the next task to be run. */\r
- portEND_SWITCHING_ISR();\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-void vPortEndScheduler( void )\r
-{\r
- /* Not implemented. */\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-static void prvSetupTimerInterrupt( void )\r
-{\r
-const unsigned portLONG ulCompareValue = portTIMER_COMPARE;\r
-unsigned portSHORT usTimerCompare;\r
-\r
- usTimerCompare = ( unsigned portSHORT ) ( ulCompareValue >> 4UL );\r
- t2_init( portENABLE_TIMER, portPRESCALE_VALUE, NULL );\r
-\r
- #if( configUSE_PREEMPTION == 1 )\r
- /* Tick service routine used by the scheduler when preemptive scheduling is\r
- being used. */\r
- t1_init( portENABLE_TIMER_AND_INTERRUPT, usTimerCompare, usTimerCompare, prvPreemptiveTick );\r
- #else\r
- /* Tick service routine used by the scheduler when cooperative scheduling is\r
- being used. */\r
- t1_init( portENABLE_TIMER_AND_INTERRUPT, usTimerCompare, usTimerCompare, prvNonPreemptiveTick );\r
- #endif\r
-}\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r