]> git.sur5r.net Git - freertos/commitdiff
Start work on official MSP430X port layer for IAR.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Tue, 28 Dec 2010 15:22:17 +0000 (15:22 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Tue, 28 Dec 2010 15:22:17 +0000 (15:22 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1187 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Source/portable/IAR/MSP430X/port.c [new file with mode: 0644]
Source/portable/IAR/MSP430X/portasm.h [new file with mode: 0644]
Source/portable/IAR/MSP430X/portext.s43 [new file with mode: 0644]
Source/portable/IAR/MSP430X/portmacro.h [new file with mode: 0644]

diff --git a/Source/portable/IAR/MSP430X/port.c b/Source/portable/IAR/MSP430X/port.c
new file mode 100644 (file)
index 0000000..a008016
--- /dev/null
@@ -0,0 +1,197 @@
+/*\r
+    FreeRTOS V6.1.0 - Copyright (C) 2010 Real Time Engineers Ltd.\r
+\r
+    ***************************************************************************\r
+    *                                                                         *\r
+    * If you are:                                                             *\r
+    *                                                                         *\r
+    *    + New to FreeRTOS,                                                   *\r
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *\r
+    *    + Looking for basic training,                                        *\r
+    *    + Wanting to improve your FreeRTOS skills and productivity           *\r
+    *                                                                         *\r
+    * then take a look at the FreeRTOS books - available as PDF or paperback  *\r
+    *                                                                         *\r
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *\r
+    *                  http://www.FreeRTOS.org/Documentation                  *\r
+    *                                                                         *\r
+    * A pdf reference manual is also available.  Both are usually delivered   *\r
+    * to your inbox within 20 minutes to two hours when purchased between 8am *\r
+    * and 8pm GMT (although please allow up to 24 hours in case of            *\r
+    * exceptional circumstances).  Thank you for your support!                *\r
+    *                                                                         *\r
+    ***************************************************************************\r
+\r
+    This file is part of the FreeRTOS distribution.\r
+\r
+    FreeRTOS is free software; you can redistribute it and/or modify it under\r
+    the terms of the GNU General Public License (version 2) as published by the\r
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
+    ***NOTE*** The exception to the GPL is included to allow you to distribute\r
+    a combined work that includes FreeRTOS without being obliged to provide the\r
+    source code for proprietary components outside of the FreeRTOS kernel.\r
+    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\r
+    more details. You should have received a copy of the GNU General Public\r
+    License and the FreeRTOS license exception along with FreeRTOS; if not it\r
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
+    by writing to Richard Barry, contact details for whom are available on the\r
+    FreeRTOS WEB site.\r
+\r
+    1 tab == 4 spaces!\r
+\r
+    http://www.FreeRTOS.org - Documentation, latest information, license and\r
+    contact details.\r
+\r
+    http://www.SafeRTOS.com - A version that is certified for use in safety\r
+    critical systems.\r
+\r
+    http://www.OpenRTOS.com - Commercial support, development, porting,\r
+    licensing and training services.\r
+*/\r
+\r
+/* Scheduler includes. */\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+\r
+/*-----------------------------------------------------------\r
+ * Implementation of functions defined in portable.h for the MSP430X port.\r
+ *----------------------------------------------------------*/\r
+\r
+/* Constants required for hardware setup.  The tick ISR runs off the ACLK,\r
+not the MCLK. */\r
+#define portACLK_FREQUENCY_HZ                  ( ( portTickType ) 32768 )\r
+#define portINITIAL_CRITICAL_NESTING   ( ( unsigned short ) 10 )\r
+#define portFLAGS_INT_ENABLED                  ( ( portSTACK_TYPE ) 0x08 )\r
+\r
+/* We require the address of the pxCurrentTCB variable, but don't want to know\r
+any details of its type. */\r
+typedef void tskTCB;\r
+extern volatile tskTCB * volatile pxCurrentTCB;\r
+\r
+/* Each task maintains a count of the critical section nesting depth.  Each\r
+time a critical section is entered the count is incremented.  Each time a\r
+critical section is exited the count is decremented - with interrupts only\r
+being re-enabled if the count is zero.\r
+\r
+usCriticalNesting will get set to zero when the scheduler starts, but must\r
+not be initialised to zero as this will cause problems during the startup\r
+sequence. */\r
+volatile unsigned short usCriticalNesting = portINITIAL_CRITICAL_NESTING;\r
+/*-----------------------------------------------------------*/\r
+\r
+\r
+/*\r
+ * Sets up the periodic ISR used for the RTOS tick.  This uses timer 0, but\r
+ * could have alternatively used the watchdog timer or timer 1.\r
+ */\r
+void vPortSetupTimerInterrupt( void );\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+ * Initialise the stack of a task to look exactly as if a call to\r
+ * portSAVE_CONTEXT had been called.\r
+ *\r
+ * See the header file portable.h.\r
+ */\r
+portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )\r
+{\r
+unsigned short usNibble;\r
+unsigned short *pus16BitPointer;\r
+unsigned long ulSP_PC_Combined;\r
+\r
+       /*\r
+               Place a few bytes of known values on the bottom of the stack.\r
+               This is just useful for debugging and can be included if required.\r
+\r
+               *pxTopOfStack = ( portSTACK_TYPE ) 0x1111;\r
+               pxTopOfStack--;\r
+               *pxTopOfStack = ( portSTACK_TYPE ) 0x2222;\r
+               pxTopOfStack--;\r
+               *pxTopOfStack = ( portSTACK_TYPE ) 0x3333;\r
+               pxTopOfStack--;\r
+       */\r
+\r
+       /* The msp430x automatically pushes the PC then SR onto the stack before\r
+       executing an ISR.  We want the stack to look just as if this has happened\r
+       so place a pointer to the start of the task on the stack first - followed\r
+       by the flags we want the task to use when it starts up. */\r
+//     pus16BitPointer = ( unsigned short * ) pxTopOfStack;\r
+//     *pus16BitPointer = ( unsigned short ) pxCode;\r
+//     pus16BitPointer--;\r
+       \r
+       /* When placed on the stack, the top four bits of the status register\r
+       contain bits 19:16 of the 20 bit return address (pxCode). */\r
+       usNibble = ( unsigned short ) ( ( ( unsigned long ) pxCode >> 15UL ) & 0x0fUL );\r
+//     *pus16BitPointer = ( usNibble | portFLAGS_INT_ENABLED );\r
+//     pus16BitPointer--;\r
+\r
+//     pxTopOfStack = ( portSTACK_TYPE * ) pus16BitPointer;\r
+\r
+       ulSP_PC_Combined = ( unsigned long ) pxCode;\r
+       ulSP_PC_Combined <<= 16;\r
+       ulSP_PC_Combined |= ( usNibble << 12 );\r
+       ulSP_PC_Combined |= portFLAGS_INT_ENABLED;\r
+       *pxTopOfStack = ulSP_PC_Combined;\r
+       pxTopOfStack--;\r
+\r
+       /* Next the general purpose registers. */\r
+       *pxTopOfStack = ( portSTACK_TYPE ) 0xffffff;\r
+       pxTopOfStack--;\r
+       *pxTopOfStack = ( portSTACK_TYPE ) 0xeeeeee;\r
+       pxTopOfStack--;\r
+       *pxTopOfStack = ( portSTACK_TYPE ) 0xdddddd;\r
+       pxTopOfStack--;\r
+       *pxTopOfStack = ( portSTACK_TYPE ) 0xcccccc;\r
+       pxTopOfStack--;\r
+       *pxTopOfStack = ( portSTACK_TYPE ) 0xbbbbbb;\r
+       pxTopOfStack--;\r
+       *pxTopOfStack = ( portSTACK_TYPE ) 0xaaaaaa;\r
+       pxTopOfStack--;\r
+       *pxTopOfStack = ( portSTACK_TYPE ) 0x999999;\r
+       pxTopOfStack--;\r
+       *pxTopOfStack = ( portSTACK_TYPE ) 0x888888;\r
+       pxTopOfStack--; \r
+       \r
+       /* When the task starts is will expect to find the function parameter in\r
+       R15. */\r
+       *pxTopOfStack = ( portSTACK_TYPE ) 0x555555;\r
+       pxTopOfStack--;\r
+       \r
+       *pxTopOfStack = ( portSTACK_TYPE ) 0x666666;\r
+       pxTopOfStack--;\r
+       *pxTopOfStack = ( portSTACK_TYPE ) 0x555555;\r
+       pxTopOfStack--;\r
+       *pxTopOfStack = ( portSTACK_TYPE ) 0x444444;\r
+       pxTopOfStack--;\r
+\r
+       /* A variable is used to keep track of the critical section nesting.\r
+       This variable has to be stored as part of the task context and is\r
+       initially set to zero. */\r
+       *pxTopOfStack = ( portSTACK_TYPE ) portNO_CRITICAL_SECTION_NESTING;     \r
+\r
+       /* Return a pointer to the top of the stack we have generated so this can\r
+       be stored in the task control block for the task. */\r
+       return pxTopOfStack;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vPortEndScheduler( void )\r
+{\r
+       /* It is unlikely that the MSP430 port will get stopped.  If required simply\r
+       disable the tick interrupt here. */\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/*\r
+ * Hardware initialisation to generate the RTOS tick.\r
+ */\r
+void vPortSetupTimerInterrupt( void )\r
+{\r
+       vApplicationSetupTimerInterrupt();\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+\r
+       \r
diff --git a/Source/portable/IAR/MSP430X/portasm.h b/Source/portable/IAR/MSP430X/portasm.h
new file mode 100644 (file)
index 0000000..95b0d51
--- /dev/null
@@ -0,0 +1,99 @@
+/*\r
+    FreeRTOS V6.1.0 - Copyright (C) 2010 Real Time Engineers Ltd.\r
+\r
+    ***************************************************************************\r
+    *                                                                         *\r
+    * If you are:                                                             *\r
+    *                                                                         *\r
+    *    + New to FreeRTOS,                                                   *\r
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *\r
+    *    + Looking for basic training,                                        *\r
+    *    + Wanting to improve your FreeRTOS skills and productivity           *\r
+    *                                                                         *\r
+    * then take a look at the FreeRTOS books - available as PDF or paperback  *\r
+    *                                                                         *\r
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *\r
+    *                  http://www.FreeRTOS.org/Documentation                  *\r
+    *                                                                         *\r
+    * A pdf reference manual is also available.  Both are usually delivered   *\r
+    * to your inbox within 20 minutes to two hours when purchased between 8am *\r
+    * and 8pm GMT (although please allow up to 24 hours in case of            *\r
+    * exceptional circumstances).  Thank you for your support!                *\r
+    *                                                                         *\r
+    ***************************************************************************\r
+\r
+    This file is part of the FreeRTOS distribution.\r
+\r
+    FreeRTOS is free software; you can redistribute it and/or modify it under\r
+    the terms of the GNU General Public License (version 2) as published by the\r
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
+    ***NOTE*** The exception to the GPL is included to allow you to distribute\r
+    a combined work that includes FreeRTOS without being obliged to provide the\r
+    source code for proprietary components outside of the FreeRTOS kernel.\r
+    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\r
+    more details. You should have received a copy of the GNU General Public\r
+    License and the FreeRTOS license exception along with FreeRTOS; if not it\r
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
+    by writing to Richard Barry, contact details for whom are available on the\r
+    FreeRTOS WEB site.\r
+\r
+    1 tab == 4 spaces!\r
+\r
+    http://www.FreeRTOS.org - Documentation, latest information, license and\r
+    contact details.\r
+\r
+    http://www.SafeRTOS.com - A version that is certified for use in safety\r
+    critical systems.\r
+\r
+    http://www.OpenRTOS.com - Commercial support, development, porting,\r
+    licensing and training services.\r
+*/\r
+\r
+#ifndef PORTASM_H\r
+#define PORTASM_H\r
+\r
+portSAVE_CONTEXT macro\r
+\r
+               IMPORT pxCurrentTCB\r
+               IMPORT usCriticalNesting\r
+\r
+               /* Save the remaining registers. */\r
+               push    r4\r
+               push    r5\r
+               push    r6\r
+               push    r7\r
+               push    r8\r
+               push    r9\r
+               push    r10\r
+               push    r11\r
+               push    r12\r
+               push    r13\r
+               push    r14\r
+               push    r15\r
+               mov.w   &usCriticalNesting, r14\r
+               push    r14\r
+               mov.w   &pxCurrentTCB, r12\r
+               mov.w   r1, 0(r12)\r
+               endm\r
+/*-----------------------------------------------------------*/\r
+               \r
+portRESTORE_CONTEXT macro\r
+               movx.a  &pxCurrentTCB, r12\r
+               movx.a  @r12, r1\r
+               popx.a  r15\r
+               movx.w  r15, &usCriticalNesting\r
+               popm.a  #12, r15\r
+                       \r
+               /* The last thing on the stack will be the status register.\r
+        Ensure the power down bits are clear ready for the next\r
+        time this power down register is popped from the stack. */\r
+               bic.w   #0xf0, 0( SP )\r
+\r
+               reti\r
+               endm\r
+/*-----------------------------------------------------------*/\r
+\r
+#endif\r
+\r
diff --git a/Source/portable/IAR/MSP430X/portext.s43 b/Source/portable/IAR/MSP430X/portext.s43
new file mode 100644 (file)
index 0000000..a96a81b
--- /dev/null
@@ -0,0 +1,133 @@
+/*\r
+    FreeRTOS V6.1.0 - Copyright (C) 2010 Real Time Engineers Ltd.\r
+\r
+    ***************************************************************************\r
+    *                                                                         *\r
+    * If you are:                                                             *\r
+    *                                                                         *\r
+    *    + New to FreeRTOS,                                                   *\r
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *\r
+    *    + Looking for basic training,                                        *\r
+    *    + Wanting to improve your FreeRTOS skills and productivity           *\r
+    *                                                                         *\r
+    * then take a look at the FreeRTOS books - available as PDF or paperback  *\r
+    *                                                                         *\r
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *\r
+    *                  http://www.FreeRTOS.org/Documentation                  *\r
+    *                                                                         *\r
+    * A pdf reference manual is also available.  Both are usually delivered   *\r
+    * to your inbox within 20 minutes to two hours when purchased between 8am *\r
+    * and 8pm GMT (although please allow up to 24 hours in case of            *\r
+    * exceptional circumstances).  Thank you for your support!                *\r
+    *                                                                         *\r
+    ***************************************************************************\r
+\r
+    This file is part of the FreeRTOS distribution.\r
+\r
+    FreeRTOS is free software; you can redistribute it and/or modify it under\r
+    the terms of the GNU General Public License (version 2) as published by the\r
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
+    ***NOTE*** The exception to the GPL is included to allow you to distribute\r
+    a combined work that includes FreeRTOS without being obliged to provide the\r
+    source code for proprietary components outside of the FreeRTOS kernel.\r
+    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\r
+    more details. You should have received a copy of the GNU General Public\r
+    License and the FreeRTOS license exception along with FreeRTOS; if not it\r
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
+    by writing to Richard Barry, contact details for whom are available on the\r
+    FreeRTOS WEB site.\r
+\r
+    1 tab == 4 spaces!\r
+\r
+    http://www.FreeRTOS.org - Documentation, latest information, license and\r
+    contact details.\r
+\r
+    http://www.SafeRTOS.com - A version that is certified for use in safety\r
+    critical systems.\r
+\r
+    http://www.OpenRTOS.com - Commercial support, development, porting,\r
+    licensing and training services.\r
+*/\r
+#include "msp430.h"\r
+#include "FreeRTOSConfig.h"\r
+#include "portasm.h"\r
+\r
+       IMPORT vTaskIncrementTick\r
+       IMPORT vTaskSwitchContext\r
+       IMPORT vPortSetupTimerInterrupt\r
+\r
+       EXPORT vTickISR\r
+       EXPORT vPortYield\r
+       EXPORT xPortStartScheduler\r
+       \r
+       RSEG CODE\r
+\r
+/*\r
+ * The RTOS tick ISR.\r
+ *\r
+ * If the cooperative scheduler is in use this simply increments the tick\r
+ * count.\r
+ *\r
+ * If the preemptive scheduler is in use a context switch can also occur.\r
+ */\r
+vTickISR:\r
+       portSAVE_CONTEXT\r
+                               \r
+       calla   #vTaskIncrementTick\r
+\r
+       #if configUSE_PREEMPTION == 1\r
+               calla   #vTaskSwitchContext\r
+       #endif\r
+               \r
+       portRESTORE_CONTEXT\r
+/*-----------------------------------------------------------*/\r
+\r
+\r
+/*\r
+ * Manual context switch called by the portYIELD() macro.\r
+ */\r
+vPortYield:\r
+\r
+       /* Mimic an interrupt by pushing the SR. */\r
+       push    SR                      \r
+\r
+       /* Now the SR is stacked we can disable interrupts. */\r
+       dint                    \r
+                               \r
+       /* Save the context of the current task. */\r
+       portSAVE_CONTEXT                        \r
+\r
+       /* Switch to the highest priority task that is ready to run. */\r
+       calla   #vTaskSwitchContext             \r
+\r
+       /* Restore the context of the new task. */\r
+       portRESTORE_CONTEXT\r
+/*-----------------------------------------------------------*/\r
+\r
+\r
+/*\r
+ * Start off the scheduler by initialising the RTOS tick timer, then restoring\r
+ * the context of the first task.\r
+ */\r
+xPortStartScheduler:\r
+\r
+       /* Setup the hardware to generate the tick.  Interrupts are disabled\r
+       when this function is called. */\r
+       calla   #vPortSetupTimerInterrupt\r
+\r
+       /* Restore the context of the first task that is going to run. */\r
+       portRESTORE_CONTEXT\r
+/*-----------------------------------------------------------*/\r
+               \r
+\r
+       /* Install vTickISR as the timer A0 interrupt. */\r
+       ASEG\r
+       ORG 0xFFE0 + configTICK_INTERRUPT_VECTOR\r
+       \r
+       _vTickISR_: DC16 vTickISR\r
+       \r
+\r
+       END\r
+               \r
diff --git a/Source/portable/IAR/MSP430X/portmacro.h b/Source/portable/IAR/MSP430X/portmacro.h
new file mode 100644 (file)
index 0000000..42d8c7d
--- /dev/null
@@ -0,0 +1,156 @@
+/*\r
+    FreeRTOS V6.1.0 - Copyright (C) 2010 Real Time Engineers Ltd.\r
+\r
+    ***************************************************************************\r
+    *                                                                         *\r
+    * If you are:                                                             *\r
+    *                                                                         *\r
+    *    + New to FreeRTOS,                                                   *\r
+    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *\r
+    *    + Looking for basic training,                                        *\r
+    *    + Wanting to improve your FreeRTOS skills and productivity           *\r
+    *                                                                         *\r
+    * then take a look at the FreeRTOS books - available as PDF or paperback  *\r
+    *                                                                         *\r
+    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *\r
+    *                  http://www.FreeRTOS.org/Documentation                  *\r
+    *                                                                         *\r
+    * A pdf reference manual is also available.  Both are usually delivered   *\r
+    * to your inbox within 20 minutes to two hours when purchased between 8am *\r
+    * and 8pm GMT (although please allow up to 24 hours in case of            *\r
+    * exceptional circumstances).  Thank you for your support!                *\r
+    *                                                                         *\r
+    ***************************************************************************\r
+\r
+    This file is part of the FreeRTOS distribution.\r
+\r
+    FreeRTOS is free software; you can redistribute it and/or modify it under\r
+    the terms of the GNU General Public License (version 2) as published by the\r
+    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
+    ***NOTE*** The exception to the GPL is included to allow you to distribute\r
+    a combined work that includes FreeRTOS without being obliged to provide the\r
+    source code for proprietary components outside of the FreeRTOS kernel.\r
+    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\r
+    more details. You should have received a copy of the GNU General Public\r
+    License and the FreeRTOS license exception along with FreeRTOS; if not it\r
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
+    by writing to Richard Barry, contact details for whom are available on the\r
+    FreeRTOS WEB site.\r
+\r
+    1 tab == 4 spaces!\r
+\r
+    http://www.FreeRTOS.org - Documentation, latest information, license and\r
+    contact details.\r
+\r
+    http://www.SafeRTOS.com - A version that is certified for use in safety\r
+    critical systems.\r
+\r
+    http://www.OpenRTOS.com - Commercial support, development, porting,\r
+    licensing and training services.\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
+/* Hardware includes. */\r
+#include "msp430.h"\r
+\r
+/* Type definitions. */\r
+#define portCHAR               char\r
+#define portFLOAT              float\r
+#define portDOUBLE             double\r
+#define portLONG               long\r
+#define portSHORT              int\r
+#define portSTACK_TYPE unsigned portLONG\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
+\r
+/* Interrupt control macros. */\r
+#define portDISABLE_INTERRUPTS()       _DINT();\r
+#define portENABLE_INTERRUPTS()                _EINT();\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Critical section control macros. */\r
+#define portNO_CRITICAL_SECTION_NESTING                ( ( unsigned portSHORT ) 0 )\r
+\r
+#define portENTER_CRITICAL()                                                                                                   \\r
+{                                                                                                                                                              \\r
+extern volatile unsigned short usCriticalNesting;                                                              \\r
+                                                                                                                                                               \\r
+       portDISABLE_INTERRUPTS();                                                                                                       \\r
+                                                                                                                                                               \\r
+       /* Now interrupts are disabled usCriticalNesting can be accessed */                     \\r
+       /* directly.  Increment ulCriticalNesting to keep a count of how many */        \\r
+       /* times portENTER_CRITICAL() has been called. */                                                       \\r
+       usCriticalNesting++;                                                                                                            \\r
+}\r
+\r
+#define portEXIT_CRITICAL()                                                                                                            \\r
+{                                                                                                                                                              \\r
+extern volatile unsigned short usCriticalNesting;                                                      \\r
+                                                                                                                                                               \\r
+       if( usCriticalNesting > portNO_CRITICAL_SECTION_NESTING )                                       \\r
+       {                                                                                                                                                       \\r
+               /* Decrement the nesting count as we are leaving a critical section. */ \\r
+               usCriticalNesting--;                                                                                                    \\r
+                                                                                                                                                               \\r
+               /* If the nesting level has reached zero then interrupts should be */   \\r
+               /* re-enabled. */                                                                                                               \\r
+               if( usCriticalNesting == portNO_CRITICAL_SECTION_NESTING )                              \\r
+               {                                                                                                                                               \\r
+                       portENABLE_INTERRUPTS();                                                                                        \\r
+               }                                                                                                                                               \\r
+       }                                                                                                                                                       \\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Task utilities. */\r
+\r
+/*\r
+ * Manual context switch called by portYIELD or taskYIELD.\r
+ */\r
+extern void vPortYield( void );\r
+#define portYIELD() vPortYield()\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Hardware specifics. */\r
+#define portBYTE_ALIGNMENT                     4\r
+#define portSTACK_GROWTH                       ( -1 )\r
+#define portTICK_RATE_MS                       ( ( portTickType ) 1000 / configTICK_RATE_HZ )  \r
+#define portNOP()      \r
+/*-----------------------------------------------------------*/\r
+\r
+/* Task function macros as described on the FreeRTOS.org WEB site. */\r
+#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )\r
+#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )\r
+\r
+#if configINTERRUPT_EXAMPLE_METHOD == 2\r
+       extern void vTaskSwitchContext( void );\r
+       #define portYIELD_FROM_ISR( x ) if( x ) vTaskSwitchContext()\r
+#endif /* configINTERRUPT_EXAMPLE_METHOD */\r
+       \r
+void vApplicationSetupTimerInterrupt( void );\r
+\r
+#endif /* PORTMACRO_H */\r
+\r