]> git.sur5r.net Git - freertos/commitdiff
New port files for Tern E-Engine.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sat, 27 May 2006 13:59:20 +0000 (13:59 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sat, 27 May 2006 13:59:20 +0000 (13:59 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@9 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Source/portable/Paradigm/Tern_EE/large_untested/port.c [new file with mode: 0644]
Source/portable/Paradigm/Tern_EE/large_untested/portasm.h [new file with mode: 0644]
Source/portable/Paradigm/Tern_EE/large_untested/portmacro.h [new file with mode: 0644]
Source/portable/Paradigm/Tern_EE/small/PORTASM.bak [new file with mode: 0644]
Source/portable/Paradigm/Tern_EE/small/port.bak [new file with mode: 0644]
Source/portable/Paradigm/Tern_EE/small/port.c [new file with mode: 0644]
Source/portable/Paradigm/Tern_EE/small/portasm.h [new file with mode: 0644]
Source/portable/Paradigm/Tern_EE/small/portmacro.h [new file with mode: 0644]

diff --git a/Source/portable/Paradigm/Tern_EE/large_untested/port.c b/Source/portable/Paradigm/Tern_EE/large_untested/port.c
new file mode 100644 (file)
index 0000000..23efd54
--- /dev/null
@@ -0,0 +1,220 @@
+/*\r
+       FreeRTOS V4.0.1 - Copyright (C) 2003-2006 Richard Barry.\r
+\r
+       This file is part of the FreeRTOS distribution.\r
+\r
+       FreeRTOS 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 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; 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, 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
+*/\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 portTIMER_COMPARE ( unsigned portSHORT ) ( ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) / ( unsigned portLONG ) 4 )\r
+\r
+/* From the RDC data sheet. */\r
+#define portENABLE_TIMER_AND_INTERRUPT ( unsigned portSHORT ) 0xe001\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
+       /* 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_SEG( pvParameters );\r
+       pxTopOfStack--;\r
+       *pxTopOfStack = FP_OFF( pvParameters );\r
+       pxTopOfStack--;\r
+       *pxTopOfStack = FP_SEG( pxCode );\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
+       /* We need the true data segment. */\r
+       __asm{  MOV DS_Reg, DS };\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
+               portSWITCH_CONTEXT();\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
+       portSWITCH_CONTEXT();\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vPortEndScheduler( void )\r
+{\r
+       /* Not implemented. */\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvSetupTimerInterrupt( void )\r
+{\r
+const unsigned portSHORT usTimerACompare = portTIMER_COMPARE, usTimerAMode = portENABLE_TIMER_AND_INTERRUPT;\r
+\r
+       #if( configUSE_PREEMPTION == 1 )\r
+               /* Tick service routine used by the scheduler when preemptive scheduling is\r
+               being used. */\r
+               t2_init( usTimerAMode, usTimerACompare, prvPreemptiveTick );\r
+       #else\r
+               /* Tick service routine used by the scheduler when cooperative scheduling is\r
+               being used. */\r
+               t2_init( usTimerAMode, usTimerACompare, prvNonPreemptiveTick );\r
+       #endif\r
+}\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
diff --git a/Source/portable/Paradigm/Tern_EE/large_untested/portasm.h b/Source/portable/Paradigm/Tern_EE/large_untested/portasm.h
new file mode 100644 (file)
index 0000000..0ea2489
--- /dev/null
@@ -0,0 +1,81 @@
+/*\r
+       FreeRTOS V4.0.1 - Copyright (C) 2003-2006 Richard Barry.\r
+\r
+       This file is part of the FreeRTOS distribution.\r
+\r
+       FreeRTOS 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 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; 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, 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
+*/\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       ax, seg pxCurrentTCB            }\r
+//                                                     asm { mov       ds, ax                                          }\r
+//                                                     asm { les       bx, pxCurrentTCB                        }       /* Save the stack pointer into the TCB. */\r
+//                                                     asm { mov       es:0x2[ bx ], ss                        }\r
+//                                                     asm { mov       es:[ bx ], sp                           }\r
+//                                                     asm { call  far ptr vTaskSwitchContext  }       /* Perform the switch. */\r
+//                                                     asm { mov       ax, seg pxCurrentTCB            }       /* Restore the stack pointer from the TCB. */\r
+//                                                     asm { mov       ds, ax                                          }\r
+//                                                     asm { les       bx, dword ptr pxCurrentTCB      }\r
+//                                                     asm { mov       ss, es:[ bx + 2 ]                       }       \r
+//                                                     asm { mov       sp, es:[ bx ]                           }\r
+\r
+#define portFIRST_CONTEXT()                                                                                            \\r
+                                                       asm { mov       ax, seg pxCurrentTCB            }       \\r
+                                                       asm { mov       ds, ax                                          }       \\r
+                                                       asm { les       bx, dword ptr pxCurrentTCB      }       \\r
+                                                       asm { mov       ss, es:[ bx + 2 ]                       }       \\r
+                                                       asm { mov       sp, es:[ bx ]                           }       \\r
+                                                       asm { pop       bx                                                      }       \\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
diff --git a/Source/portable/Paradigm/Tern_EE/large_untested/portmacro.h b/Source/portable/Paradigm/Tern_EE/large_untested/portmacro.h
new file mode 100644 (file)
index 0000000..b2abfd9
--- /dev/null
@@ -0,0 +1,98 @@
+/*\r
+       FreeRTOS V4.0.1 - Copyright (C) 2003-2006 Richard Barry.\r
+\r
+       This file is part of the FreeRTOS distribution.\r
+\r
+       FreeRTOS 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 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; 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, 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
+*/\r
+\r
+#ifndef PORTMACRO_H\r
+#define PORTMACRO_H\r
+\r
+/*-----------------------------------------------------------\r
+ * Port specific definitions.  \r
+ *\r
+ * The settings in this file configure FreeRTOS correctly for the\r
+ * given hardware and compiler.\r
+ *\r
+ * These settings should not be altered.\r
+ *-----------------------------------------------------------\r
+ */\r
+\r
+/* Type definitions. */\r
+#define portCHAR               char\r
+#define portFLOAT              float\r
+#define portDOUBLE             long\r
+#define portLONG               long\r
+#define portSHORT              int\r
+#define portSTACK_TYPE unsigned portSHORT\r
+#define portBASE_TYPE  portSHORT\r
+\r
+#if( configUSE_16_BIT_TICKS == 1 )\r
+       typedef unsigned portSHORT portTickType;\r
+       #define portMAX_DELAY ( portTickType ) 0xffff\r
+#else\r
+       typedef unsigned portLONG portTickType;\r
+       #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Critical section handling. */\r
+#define portENTER_CRITICAL()                   __asm{ pushf }  \\r
+                                                                               __asm{ cli       }      \\r
+\r
+#define portEXIT_CRITICAL()                            __asm{ popf }\r
+\r
+#define portDISABLE_INTERRUPTS()               __asm{ cli }\r
+\r
+#define portENABLE_INTERRUPTS()                        __asm{ sti }\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Hardware specifics. */\r
+#define portNOP()                                              __asm{ nop }\r
+#define portSTACK_GROWTH                               ( -1 )\r
+#define portSWITCH_INT_NUMBER                  0x80\r
+#define portYIELD()                                            __asm{ int portSWITCH_INT_NUMBER } \r
+#define portTICK_RATE_MS                               ( ( portTickType ) 1000 / configTICK_RATE_HZ )          \r
+#define portBYTE_ALIGNMENT                             2\r
+#define portINITIAL_SW                                 ( ( portSTACK_TYPE ) 0x0202 )   /* Start the tasks with interrupts enabled. */\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Compiler specifics. */\r
+#define portINPUT_BYTE( xAddr )                                inp( xAddr )\r
+#define portOUTPUT_BYTE( xAddr, ucValue )      outp( xAddr, ucValue )\r
+#define portINPUT_WORD( xAddr )                                inpw( xAddr )\r
+#define portOUTPUT_WORD( xAddr, usValue )      outpw( xAddr, usValue )\r
+#define inline\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Task function macros as described on the FreeRTOS.org WEB site. */\r
+#define portTASK_FUNCTION_PROTO( vTaskFunction, vParameters ) void vTaskFunction( void *pvParameters )\r
+#define portTASK_FUNCTION( vTaskFunction, vParameters ) void vTaskFunction( void *pvParameters )\r
+\r
+#endif /* PORTMACRO_H */\r
+\r
diff --git a/Source/portable/Paradigm/Tern_EE/small/PORTASM.bak b/Source/portable/Paradigm/Tern_EE/small/PORTASM.bak
new file mode 100644 (file)
index 0000000..1f01b28
--- /dev/null
@@ -0,0 +1,76 @@
+/*\r
+       FreeRTOS V4.0.1 - Copyright (C) 2003-2006 Richard Barry.\r
+\r
+       This file is part of the FreeRTOS distribution.\r
+\r
+       FreeRTOS 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 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; 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, 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
+*/\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
diff --git a/Source/portable/Paradigm/Tern_EE/small/port.bak b/Source/portable/Paradigm/Tern_EE/small/port.bak
new file mode 100644 (file)
index 0000000..9e4df81
--- /dev/null
@@ -0,0 +1,222 @@
+/*\r
+       FreeRTOS V4.0.1 - Copyright (C) 2003-2006 Richard Barry.\r
+\r
+       This file is part of the FreeRTOS distribution.\r
+\r
+       FreeRTOS 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 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; 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, 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
+*/\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
diff --git a/Source/portable/Paradigm/Tern_EE/small/port.c b/Source/portable/Paradigm/Tern_EE/small/port.c
new file mode 100644 (file)
index 0000000..40c61f5
--- /dev/null
@@ -0,0 +1,222 @@
+/*\r
+       FreeRTOS V4.0.1 - Copyright (C) 2003-2006 Richard Barry.\r
+\r
+       This file is part of the FreeRTOS distribution.\r
+\r
+       FreeRTOS 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 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; 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, 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
+*/\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 >> 4 );\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
diff --git a/Source/portable/Paradigm/Tern_EE/small/portasm.h b/Source/portable/Paradigm/Tern_EE/small/portasm.h
new file mode 100644 (file)
index 0000000..af75553
--- /dev/null
@@ -0,0 +1,77 @@
+/*\r
+       FreeRTOS V4.0.1 - Copyright (C) 2003-2006 Richard Barry.\r
+\r
+       This file is part of the FreeRTOS distribution.\r
+\r
+       FreeRTOS 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 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; 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, 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
+*/\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 portEND_SWITCHING_ISR( 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 portEND_SWITCHING_ISR()                                                                                        \\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
+\r
diff --git a/Source/portable/Paradigm/Tern_EE/small/portmacro.h b/Source/portable/Paradigm/Tern_EE/small/portmacro.h
new file mode 100644 (file)
index 0000000..e1786de
--- /dev/null
@@ -0,0 +1,100 @@
+/*\r
+       FreeRTOS V4.0.1 - Copyright (C) 2003-2006 Richard Barry.\r
+\r
+       This file is part of the FreeRTOS distribution.\r
+\r
+       FreeRTOS 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 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; 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, 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
+*/\r
+\r
+#ifndef PORTMACRO_H\r
+#define PORTMACRO_H\r
+\r
+/*-----------------------------------------------------------\r
+ * Port specific definitions.  \r
+ *\r
+ * The settings in this file configure FreeRTOS correctly for the\r
+ * given hardware and compiler.\r
+ *\r
+ * These settings should not be altered.\r
+ *-----------------------------------------------------------\r
+ */\r
+\r
+/* Type definitions. */\r
+#define portCHAR               char\r
+#define portFLOAT              float\r
+#define portDOUBLE             long\r
+#define portLONG               long\r
+#define portSHORT              int\r
+#define portSTACK_TYPE unsigned portSHORT\r
+#define portBASE_TYPE  portSHORT\r
+\r
+typedef void ( __interrupt __far *pxISR )();\r
+\r
+#if( configUSE_16_BIT_TICKS == 1 )\r
+       typedef unsigned portSHORT portTickType;\r
+       #define portMAX_DELAY ( portTickType ) 0xffff\r
+#else\r
+       typedef unsigned portLONG portTickType;\r
+       #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Critical section handling. */\r
+#define portENTER_CRITICAL()                   __asm{ pushf }  \\r
+                                                                               __asm{ cli       }      \\r
+\r
+#define portEXIT_CRITICAL()                            __asm{ popf }\r
+\r
+#define portDISABLE_INTERRUPTS()               __asm{ cli }\r
+\r
+#define portENABLE_INTERRUPTS()                        __asm{ sti }\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Hardware specifics. */\r
+#define portNOP()                                              __asm{ nop }\r
+#define portSTACK_GROWTH                               ( -1 )\r
+#define portSWITCH_INT_NUMBER                  0x80\r
+#define portYIELD()                                            __asm{ int portSWITCH_INT_NUMBER } \r
+#define portTICK_RATE_MS                               ( ( portTickType ) 1000 / configTICK_RATE_HZ )          \r
+#define portBYTE_ALIGNMENT                             2\r
+#define portINITIAL_SW                                 ( ( portSTACK_TYPE ) 0x0202 )   /* Start the tasks with interrupts enabled. */\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Compiler specifics. */\r
+#define portINPUT_BYTE( xAddr )                                inp( xAddr )\r
+#define portOUTPUT_BYTE( xAddr, ucValue )      outp( xAddr, ucValue )\r
+#define portINPUT_WORD( xAddr )                                inpw( xAddr )\r
+#define portOUTPUT_WORD( xAddr, usValue )      outpw( xAddr, usValue )\r
+#define inline\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Task function macros as described on the FreeRTOS.org WEB site. */\r
+#define portTASK_FUNCTION_PROTO( vTaskFunction, vParameters ) void vTaskFunction( void *pvParameters )\r
+#define portTASK_FUNCTION( vTaskFunction, vParameters ) void vTaskFunction( void *pvParameters )\r
+\r
+#endif /* PORTMACRO_H */\r
+\r