+++ /dev/null
-/*\r
- FreeRTOS.org V5.0.4 - Copyright (C) 2003-2008 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
- ***************************************************************************\r
- * *\r
- * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, *\r
- * and even write all or part of your application on your behalf. *\r
- * See http://www.OpenRTOS.com for details of the services we provide to *\r
- * expedite your project. *\r
- * *\r
- ***************************************************************************\r
- ***************************************************************************\r
-\r
- Please ensure to read the configuration and relevant port sections of the\r
- online documentation.\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 MSP430 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 portSHORT ) 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 portSHORT 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 prvSetupTimerInterrupt( 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
- /* \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 msp430 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
- *pxTopOfStack = ( portSTACK_TYPE ) pxCode;\r
- pxTopOfStack--;\r
- *pxTopOfStack = portFLAGS_INT_ENABLED;\r
- pxTopOfStack--;\r
-\r
- /* Next the general purpose registers. */\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0x4444;\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0x5555;\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0x6666;\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0x7777;\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0x8888;\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0x9999;\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0xaaaa;\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0xbbbb;\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0xcccc;\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0xdddd;\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0xeeee;\r
- pxTopOfStack--;\r
-\r
- /* When the task starts is will expect to find the function parameter in\r
- R15. */\r
- *pxTopOfStack = ( portSTACK_TYPE ) pvParameters;\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. This uses timer 0\r
- * but could alternatively use the watchdog timer or timer 1. \r
- */\r
-void prvSetupTimerInterrupt( void )\r
-{\r
- /* Ensure the timer is stopped. */\r
- TACTL = 0;\r
-\r
- /* Run the timer of the ACLK. */\r
- TACTL = TASSEL_1;\r
-\r
- /* Clear everything to start with. */\r
- TACTL |= TACLR;\r
-\r
- /* Set the compare match value according to the tick rate we want. */\r
- TACCR0 = portACLK_FREQUENCY_HZ / configTICK_RATE_HZ;\r
-\r
- /* Enable the interrupts. */\r
- TACCTL0 = CCIE;\r
-\r
- /* Start up clean. */\r
- TACTL |= TACLR;\r
-\r
- /* Up mode. */\r
- TACTL |= MC_1;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-\r
- \r
+++ /dev/null
-/*\r
- FreeRTOS.org V5.0.4 - Copyright (C) 2003-2008 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
- ***************************************************************************\r
- * *\r
- * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, *\r
- * and even write all or part of your application on your behalf. *\r
- * See http://www.OpenRTOS.com for details of the services we provide to *\r
- * expedite your project. *\r
- * *\r
- ***************************************************************************\r
- ***************************************************************************\r
-\r
- Please ensure to read the configuration and relevant port sections of the\r
- online documentation.\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
-#include "FreeRTOSConfig.h"\r
-\r
-portSAVE_CONTEXT macro\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, @r12\r
- endm\r
-/*-----------------------------------------------------------*/\r
- \r
-portRESTORE_CONTEXT macro\r
- mov.w &_pxCurrentTCB, r12\r
- mov.w @r12, r1\r
- pop r15\r
- mov.w r15, &_usCriticalNesting\r
- pop r15\r
- pop r14\r
- pop r13\r
- pop r12\r
- pop r11\r
- pop r10\r
- pop r9\r
- pop r8\r
- pop r7\r
- pop r6\r
- pop r5\r
- pop r4\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
-\r
-.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
- call #_vTaskIncrementTick\r
-\r
- #if configUSE_PREEMPTION == 1\r
- call #_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
- call #_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
- call #_prvSetupTimerInterrupt\r
-\r
- /* Restore the context of the first task that is going to run. */\r
- portRESTORE_CONTEXT\r
-/*-----------------------------------------------------------*/ \r
- \r
-\r
- /* Place the tick ISR in the correct vector. */\r
- .VECTORS\r
- \r
- .KEEP\r
- \r
- ORG TIMERA0_VECTOR\r
- DW _vTickISR\r
- \r
-\r
-\r
- END\r
- \r
+++ /dev/null
-/*\r
- FreeRTOS.org V5.0.4 - Copyright (C) 2003-2008 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
- ***************************************************************************\r
- * *\r
- * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, *\r
- * and even write all or part of your application on your behalf. *\r
- * See http://www.OpenRTOS.com for details of the services we provide to *\r
- * expedite your project. *\r
- * *\r
- ***************************************************************************\r
- ***************************************************************************\r
-\r
- Please ensure to read the configuration and relevant port sections of the\r
- online documentation.\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
-/* 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 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
-\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 portSHORT 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 portSHORT 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 2\r
-#define portSTACK_GROWTH ( -1 )\r
-#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) \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 ) __toplevel\r
-\r
-\r
-/* Just used by the demo application to indicate which form of interrupt \r
-service routine should be used. See the online port documentation for more\r
-information. */\r
-#define MSP_ROWLEY_RB_PORT\r
-\r
-#define portNOP()\r
-\r
-#endif /* PORTMACRO_H */\r
-\r
+++ /dev/null
-/*\r
- FreeRTOS.org V5.0.4 - Copyright (C) 2003-2008 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
- ***************************************************************************\r
- * *\r
- * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, *\r
- * and even write all or part of your application on your behalf. *\r
- * See http://www.OpenRTOS.com for details of the services we provide to *\r
- * expedite your project. *\r
- * *\r
- ***************************************************************************\r
- ***************************************************************************\r
-\r
- Please ensure to read the configuration and relevant port sections of the\r
- online documentation.\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
-\r
-/*\r
- * Milos Prokic\r
- * \r
- * File adopted from the MSP430 GCC port\r
- * Interrupt handling, xPortStartScheduler, vPortYield, portSAVE_CONTEXT(), portRESTORE_CONTEXT() \r
-/* Standard includes. */\r
-\r
-#include <stdlib.h>\r
-\r
-/* Scheduler includes. */\r
-#include "FreeRTOS.h"\r
-#include "task.h"\r
-\r
-/*-----------------------------------------------------------\r
- * Implementation of functions defined in portable.h for the MSP430 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 portSHORT ) 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
-unsigned portCHAR ucReschedule;\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 portSHORT usCriticalNesting = portINITIAL_CRITICAL_NESTING;\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 prvSetupTimerInterrupt( 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
- /* \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 msp430 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
- *pxTopOfStack = ( portSTACK_TYPE ) pxCode;\r
- pxTopOfStack--;\r
- *pxTopOfStack = portFLAGS_INT_ENABLED;\r
- pxTopOfStack--;\r
-\r
- /* Next the general purpose registers. */\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0x4444;\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0x5555;\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0x6666;\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0x7777;\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0x8888;\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0x9999;\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0xaaaa;\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0xbbbb;\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0xcccc;\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0xdddd;\r
- pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) 0xeeee;\r
- pxTopOfStack--;\r
-\r
- /* When the task starts is will expect to find the function parameter in\r
- R15. */\r
- *pxTopOfStack = ( portSTACK_TYPE ) pvParameters;\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. This uses timer 0\r
- * but could alternatively use the watchdog timer or timer 1. \r
- */\r
-void prvSetupTimerInterrupt( void )\r
-{\r
- /* Ensure the timer is stopped. */\r
- TACTL = 0;\r
-\r
- /* Run the timer of the ACLK. */\r
- TACTL = TASSEL_1;\r
-\r
- /* Clear everything to start with. */\r
- TACTL |= TACLR;\r
-\r
- /* Set the compare match value according to the tick rate we want. */\r
- TACCR0 = portACLK_FREQUENCY_HZ / configTICK_RATE_HZ;\r
-\r
- /* Enable the interrupts. */\r
- TACCTL0 = CCIE;\r
-\r
- /* Start up clean. */\r
- TACTL |= TACLR;\r
-\r
- /* Up mode. */\r
- TACTL |= MC_1;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-/* \r
- * The interrupt service routine used depends on whether the pre-emptive\r
- * scheduler is being used or not.\r
- */\r
-\r
-#if configUSE_PREEMPTION == 1\r
-\r
- /*\r
- * Tick ISR for preemptive scheduler. We can use a naked attribute as\r
- * the context is saved at the start of vPortYieldFromTick(). The tick\r
- * count is incremented after the context is saved.\r
- */\r
- void ISROsTick( void )\r
- {\r
- /* Increment the tick count then switch to the highest priority task\r
- that is ready to run. */\r
- vTaskIncrementTick();\r
- vTaskSwitchContext();\r
- }\r
-\r
-#else\r
-\r
- /*\r
- * Tick ISR for the cooperative scheduler. All this does is increment the\r
- * tick count. We don't need to switch context, this can only be done by\r
- * manual calls to taskYIELD();\r
- */\r
- void ISROsTick( void )\r
- {\r
- vTaskIncrementTick();\r
- }\r
-#endif\r
-\r
-\r
- \r
+++ /dev/null
-#include <msp430x14x.h>\r
-\r
-/*\r
- * Milos Prokic\r
- */\r
-\r
-/**********************************************************\r
-All Interrupts should follow the naming convention : ISR"name" and declared\r
-as a normal function in C.\r
-\r
-One must not forget to allocate interrupts below (see the line "MSPINT OsTick"\r
-below for an example).\r
-\r
-By default the ISR will not cause the context switch, but if called in \r
-conjunction with portENTER_SWITCHING_ISR/portEXIT_SWITCHING_ISR(wakeup), where \r
-wakeup = TRUE upon exit the ISR will force the context switch via the \r
-ucReschedule global variable.\r
-**********************************************************/ \r
-MSPINT macro name\r
-_##name::\r
- call #_portSAVE_CONTEXT \r
- call #_ISR##name \r
- br #_portSWITCH_EXIT \r
- endm\r
-\r
-\r
-/**********************************************************\r
-API code\r
-**********************************************************/ \r
-\r
- .CODE\r
-_vPortYield::\r
- /* Mimic an INT call by pushing SR. */\r
- push SR \r
- /* no INTs !! */\r
- dint \r
- /* Save the context of the current task. */\r
- call #_portSAVE_CONTEXT \r
- /* Switch to the highest priority task that is ready to run. */\r
- call #_vTaskSwitchContext \r
- /* Restore the context of the new task. */\r
- br #_portSWITCH_EXIT \r
-\r
-_xPortStartScheduler::\r
- /* Setup the hardware to generate the tick. Interrupts are disabled when\r
- this function is called. */\r
- call #_prvSetupTimerInterrupt\r
-\r
- /* Restore the context of the first task that is going to run. */\r
- jmp _portRESTORE_CONTEXT\r
- \r
-_portSAVE_CONTEXT::\r
- /* Function to save the context. When this function is called the\r
- return address will appear on the stack. This does not need to be\r
- saved so is overwritten by R4 - hence R4 is not saved initially.\r
-\r
- Save the general purpose registers. */\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
-\r
- /* Now R10 has been saved we can use it to hold the return address, \r
- which is about to be overwritten. */\r
- mov 22(R1),R10 \r
-\r
- /* Store R4 where the return address was on the stack. */\r
- mov R4,22(R1) \r
-\r
- /* Save the critical nesting depth. */\r
- mov.w &_usCriticalNesting, R14 \r
- push R14 \r
-\r
- /* Finally save the new top of stack. */\r
- mov.w &_pxCurrentTCB, R12 \r
- mov.w R1, @R12\r
-\r
- /* No rescheduling by default. */\r
- mov.b #0,&_ucReschedule \r
-\r
- /* Return using the saved return address. */\r
- br R10 \r
-\r
-\r
-_portSWITCH_EXIT::\r
- /* Check ucReschedule to see if a context switch is required. */\r
- tst.b &_ucReschedule\r
- jz _portRESTORE_CONTEXT\r
- call #_vTaskSwitchContext\r
-_portRESTORE_CONTEXT:: \r
- /* Restore the context in the opposite order to the save. */\r
- mov.w &_pxCurrentTCB, R12\r
- mov.w @R12, R1\r
- pop R15\r
- mov.w R15, &_usCriticalNesting\r
- pop R15\r
- pop R14 \r
- pop R13 \r
- pop R12 \r
- pop R11 \r
- pop R10 \r
- pop R9 \r
- pop R8 \r
- pop R7 \r
- pop R6 \r
- pop R5 \r
- pop R4 \r
-\r
- /* Ensure any low power mode bits are cleared within the status\r
- register about to be restored. */\r
- bic #(SCG1+SCG0+OSCOFF+CPUOFF),0(SP)\r
- reti \r
- \r
-\r
-/**********************************************************\r
-Allocate Interrupts using the MSPINT macro (defined at the top of this file.\r
-ex: MSPINT "name"\r
-**********************************************************/ \r
- \r
- MSPINT OsTick\r
- MSPINT Com1Rx\r
- MSPINT Com1Tx\r
- \r
-\r
-/*********************************************************\r
-Interrupt Vectors\r
-Timer_A0\r
-ex: PORT1 would look like:\r
-ORG PORT1_VECTOR\r
-DW _"name"\r
-**********************************************************/ \r
- .VECTORS\r
- .KEEP\r
-\r
- ORG TIMERA0_VECTOR\r
- DW _OsTick\r
-\r
- ORG UART1RX_VECTOR\r
- DW _Com1Rx\r
-\r
- ORG UART1TX_VECTOR\r
- DW _Com1Tx \r
- \r
- END\r
+++ /dev/null
-/*\r
- FreeRTOS.org V5.0.4 - Copyright (C) 2003-2008 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
- ***************************************************************************\r
- * *\r
- * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, *\r
- * and even write all or part of your application on your behalf. *\r
- * See http://www.OpenRTOS.com for details of the services we provide to *\r
- * expedite your project. *\r
- * *\r
- ***************************************************************************\r
- ***************************************************************************\r
-\r
- Please ensure to read the configuration and relevant port sections of the\r
- online documentation.\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
-/* 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 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
-/* 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 portSHORT usCriticalNesting; \\r
- \\r
- portDISABLE_INTERRUPTS(); \\r
- \\r
- /* Now interrupts are disabled ulCriticalNesting 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 portSHORT 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
- \r
-#define portYIELD() vPortYield()\r
-/*-----------------------------------------------------------*/\r
-\r
-#define portENTER_SWITCHING_ISR()\r
-#define portEXIT_SWITCHING_ISR( SwitchRequired ) \\r
- { \\r
- extern unsigned portCHAR ucReschedule; \\r
- if( SwitchRequired ) \\r
- { \\r
- ucReschedule = 1; \\r
- } \\r
- }\r
-\r
-/* Hardwware specifics. */\r
-#define portBYTE_ALIGNMENT 2\r
-#define portSTACK_GROWTH ( -1 )\r
-#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) \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 ) __toplevel\r
-\r
-/* Compiler specifics. */\r
-#define portNOP()\r
-\r
-\r
-/* Just used by the demo application to indicate which form of interrupt \r
-service routine should be used. See the online port documentation for more\r
-information. */\r
-#define MSP_ROWLEY_MP_PORT\r
-\r
-#endif /* PORTMACRO_H */\r
-\r
--- /dev/null
+/*\r
+ FreeRTOS.org V5.0.4 - Copyright (C) 2003-2008 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
+ ***************************************************************************\r
+ * *\r
+ * SAVE TIME AND MONEY! We can port FreeRTOS.org to your own hardware, *\r
+ * and even write all or part of your application on your behalf. *\r
+ * See http://www.OpenRTOS.com for details of the services we provide to *\r
+ * expedite your project. *\r
+ * *\r
+ ***************************************************************************\r
+ ***************************************************************************\r
+\r
+ Please ensure to read the configuration and relevant port sections of the\r
+ online documentation.\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 PORT_ASM_H\r
+#define PORT_ASM_H\r
+\r
+portSAVE_CONTEXT macro\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, @r12\r
+ endm\r
+/*-----------------------------------------------------------*/\r
+ \r
+portRESTORE_CONTEXT macro\r
+ mov.w &_pxCurrentTCB, r12\r
+ mov.w @r12, r1\r
+ pop r15\r
+ mov.w r15, &_usCriticalNesting\r
+ pop r15\r
+ pop r14\r
+ pop r13\r
+ pop r12\r
+ pop r11\r
+ pop r10\r
+ pop r9\r
+ pop r8\r
+ pop r7\r
+ pop r6\r
+ pop r5\r
+ pop r4\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
*/\r
\r
#include "FreeRTOSConfig.h"\r
-\r
-portSAVE_CONTEXT macro\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, @r12\r
- endm\r
-/*-----------------------------------------------------------*/\r
- \r
-portRESTORE_CONTEXT macro\r
- mov.w &_pxCurrentTCB, r12\r
- mov.w @r12, r1\r
- pop r15\r
- mov.w r15, &_usCriticalNesting\r
- pop r15\r
- pop r14\r
- pop r13\r
- pop r12\r
- pop r11\r
- pop r10\r
- pop r9\r
- pop r8\r
- pop r7\r
- pop r6\r
- pop r5\r
- pop r4\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
+#include "portasm.h"\r
\r
\r
.CODE\r
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )\r
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters ) __toplevel\r
\r
+#if configINTERRUPT_EXAMPLE_METHOD == 2\r
\r
-/* Just used by the demo application to indicate which form of interrupt \r
-service routine should be used. See the online port documentation for more\r
-information. */\r
-#define MSP_ROWLEY_RB_PORT\r
+extern void vTaskSwitchContext( void );\r
+#define portYIELD_FROM_ISR( x ) if( x ) vTaskSwitchContext()\r
+\r
+#endif\r
\r
#endif /* PORTMACRO_H */\r
\r
+++ /dev/null
-To use Port1, copy the three files from the Port1 directory into this directory.\r
-\r
-To use Port2, copy the three files from the Port2 directory into this directory.\r
-\r
-Ensure to perform a complete rebuild.
\ No newline at end of file