/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
typedef void ( __interrupt __far *pxISR )();\r
#endif\r
\r
-#if __GNUC__ && (__AVR32_UC3A0256__ || \\r
- __AVR32_UC3A0512__ || \\r
- __AVR32_UC3A1128__ || \\r
- __AVR32_UC3A1256__ || \\r
- __AVR32_UC3A1512__)\r
+#ifdef GCC_AVR32_PORT\r
#include "portmacro.h"\r
#endif\r
\r
-#if __ICCAVR32__ && (__AT32UC3A0256__ || \\r
- __AT32UC3A0512__ || \\r
- __AT32UC3A1128__ || \\r
- __AT32UC3A1256__ || \\r
- __AT32UC3A1512__)\r
+#ifdef IAR_AVR32_PORT\r
#include "portmacro.h"\r
#endif\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
* MACROS AND DEFINITIONS\r
*----------------------------------------------------------*/\r
\r
-#define tskKERNEL_VERSION_NUMBER "V4.2.1"\r
+#define tskKERNEL_VERSION_NUMBER "V4.3.0"\r
\r
/**\r
* task. h\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/* \r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
*****************************************************************************/\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
*****************************************************************************/\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/* \r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
-/*
- FreeRTOS V4.1.1 - Copyright (C) 2003-2006 Richard Barry.
- MCF5235 Port - Copyright (C) 2006 Christian Walter.
-
- This file is part of the FreeRTOS distribution.
-
- FreeRTOS is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- FreeRTOS is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with FreeRTOS; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- A special exception to the GPL can be applied should you wish to distribute
- a combined work that includes FreeRTOS, without being obliged to provide
- the source code for any proprietary components. See the licensing section
- of http://www.FreeRTOS.org for full details of how and when the exception
- can be applied.
-
- ***************************************************************************
- See http://www.FreeRTOS.org for documentation, latest information, license
- and contact details. Please ensure to read the configuration and relevant
+/*\r
+ FreeRTOS V4.1.1 - Copyright (C) 2003-2006 Richard Barry.\r
+ MCF5235 Port - Copyright (C) 2006 Christian Walter.\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
Also see http://www.SafeRTOS.com for an IEC 61508 compliant version along\r
- with commercial development and support options.
- ***************************************************************************
-*/
-
-#include <stdlib.h>
-
-#include "FreeRTOS.h"
-#include "FreeRTOSConfig.h"
-#include "task.h"
-
-/* ------------------------ Types ----------------------------------------- */
-typedef volatile unsigned long vuint32;
-typedef volatile unsigned short vuint16;
-typedef volatile unsigned char vuint8;
-
-/* ------------------------ Defines --------------------------------------- */
-#define portVECTOR_TABLE __RAMVEC
-#define portVECTOR_SYSCALL ( 32 + portTRAP_YIELD )
-#define portVECTOR_TIMER ( 64 + 36 )
-
-#define MCF_PIT_PRESCALER 512UL
-#define MCF_PIT_TIMER_TICKS ( FSYS_2 / MCF_PIT_PRESCALER )
-#define MCF_PIT_MODULUS_REGISTER(freq) ( MCF_PIT_TIMER_TICKS / ( freq ) - 1UL)
-
-#define MCF_PIT_PMR0 ( *( vuint16 * )( void * )( &__IPSBAR[ 0x150002 ] ) )
-#define MCF_PIT_PCSR0 ( *( vuint16 * )( void * )( &__IPSBAR[ 0x150000 ] ) )
-#define MCF_PIT_PCSR_PRE(x) ( ( ( x ) & 0x000F ) << 8 )
-#define MCF_PIT_PCSR_EN ( 0x0001 )
-#define MCF_PIT_PCSR_RLD ( 0x0002 )
-#define MCF_PIT_PCSR_PIF ( 0x0004 )
-#define MCF_PIT_PCSR_PIE ( 0x0008 )
-#define MCF_PIT_PCSR_OVW ( 0x0010 )
-#define MCF_INTC0_ICR36 ( *( vuint8 * )( void * )( &__IPSBAR[ 0x000C64 ] ) )
-#define MCF_INTC0_IMRH ( *( vuint32 * )( void * )( &__IPSBAR[ 0x000C08 ] ) )
-#define MCF_INTC0_IMRH_INT_MASK36 ( 0x00000010 )
-#define MCF_INTC0_IMRH_MASKALL ( 0x00000001 )
-#define MCF_INTC0_ICRn_IP(x) ( ( ( x ) & 0x07 ) << 0 )
-#define MCF_INTC0_ICRn_IL(x) ( ( ( x ) & 0x07 ) << 3 )
-
-#define portNO_CRITICAL_NESTING ( ( unsigned portLONG ) 0 )
-#define portINITIAL_CRITICAL_NESTING ( ( unsigned portLONG ) 10 )
-
-/* ------------------------ Static variables ------------------------------ */
-volatile unsigned portLONG ulCriticalNesting = portINITIAL_CRITICAL_NESTING;
-
-/* ------------------------ Static functions ------------------------------ */
-#if configUSE_PREEMPTION == 0
-static void prvPortPreemptiveTick ( void ) __attribute__ ((interrupt_handler));
-#else
-static void prvPortPreemptiveTick ( void );
-#endif
-
-/* ------------------------ Start implementation -------------------------- */
-
-portSTACK_TYPE *
-pxPortInitialiseStack( portSTACK_TYPE * pxTopOfStack, pdTASK_CODE pxCode,
- void *pvParameters )
-{
- /* Place the parameter on the stack in the expected location. */
- *pxTopOfStack = ( portSTACK_TYPE ) pvParameters;
- pxTopOfStack--;
-
- /* Place dummy return address on stack. Tasks should never terminate so
- * we can set this to anything. */
- *pxTopOfStack = ( portSTACK_TYPE ) 0;
- pxTopOfStack--;
-
- /* Create a Motorola Coldfire exception stack frame. First comes the return
- * address. */
- *pxTopOfStack = ( portSTACK_TYPE ) pxCode;
- pxTopOfStack--;
-
- /* Format, fault-status, vector number for exception stack frame. Task
- * run in supervisor mode. */
- *pxTopOfStack = 0x40002000UL | ( portVECTOR_SYSCALL + 32 ) << 18;
- pxTopOfStack--;
-
- /* Set the initial critical section nesting counter to zero. This value
- * is used to restore the value of ulCriticalNesting. */
- *pxTopOfStack = 0;
- *pxTopOfStack--;
-
- *pxTopOfStack = ( portSTACK_TYPE ) 0xA6; /* A6 / FP */
- pxTopOfStack--;
- *pxTopOfStack = ( portSTACK_TYPE ) 0xA5; /* A5 */
- pxTopOfStack--;
- *pxTopOfStack = ( portSTACK_TYPE ) 0xA4; /* A4 */
- pxTopOfStack--;
- *pxTopOfStack = ( portSTACK_TYPE ) 0xA3; /* A3 */
- pxTopOfStack--;
- *pxTopOfStack = ( portSTACK_TYPE ) 0xA2; /* A2 */
- pxTopOfStack--;
- *pxTopOfStack = ( portSTACK_TYPE ) 0xA1; /* A1 */
- pxTopOfStack--;
- *pxTopOfStack = ( portSTACK_TYPE ) 0xA0; /* A0 */
- pxTopOfStack--;
- *pxTopOfStack = ( portSTACK_TYPE ) 0xD7; /* D7 */
- pxTopOfStack--;
- *pxTopOfStack = ( portSTACK_TYPE ) 0xD6; /* D6 */
- pxTopOfStack--;
- *pxTopOfStack = ( portSTACK_TYPE ) 0xD5; /* D5 */
- pxTopOfStack--;
- *pxTopOfStack = ( portSTACK_TYPE ) 0xD4; /* D4 */
- pxTopOfStack--;
- *pxTopOfStack = ( portSTACK_TYPE ) 0xD3; /* D3 */
- pxTopOfStack--;
- *pxTopOfStack = ( portSTACK_TYPE ) 0xD2; /* D2 */
- pxTopOfStack--;
- *pxTopOfStack = ( portSTACK_TYPE ) 0xD1; /* D1 */
- pxTopOfStack--;
- *pxTopOfStack = ( portSTACK_TYPE ) 0xD0; /* D0 */
-
- return pxTopOfStack;
-}
-
-/*
- * Called by portYIELD() or taskYIELD() to manually force a context switch.
- */
-static void
-prvPortYield( void )
-{
- asm volatile ( "move.w #0x2700, %sr\n\t" );
-#if _GCC_USES_FP == 1
- asm volatile ( "unlk %fp\n\t" );
-#endif
- /* Perform the context switch. First save the context of the current task. */
- portSAVE_CONTEXT( );
-
- /* Find the highest priority task that is ready to run. */
- vTaskSwitchContext( );
-
- /* Restore the context of the new task. */
- portRESTORE_CONTEXT( );
-}
-
-#if configUSE_PREEMPTION == 0
-/*
- * The ISR used for the scheduler tick depends on whether the cooperative or
- * the preemptive scheduler is being used.
- */
-static void
-prvPortPreemptiveTick ( void )
-{
- /* The cooperative scheduler requires a normal IRQ service routine to
- * simply increment the system tick.
- */
-
- vTaskIncrementTick( );
- MCF_PIT_PCSR0 |= MCF_PIT_PCSR_PIF;
-}
-
-#else
-
-static void
-prvPortPreemptiveTick( void )
-{
- asm volatile ( "move.w #0x2700, %sr\n\t" );
-#if _GCC_USES_FP == 1
- asm volatile ( "unlk %fp\n\t" );
-#endif
- portSAVE_CONTEXT( );
- MCF_PIT_PCSR0 |= MCF_PIT_PCSR_PIF;
- vTaskIncrementTick( );
- vTaskSwitchContext( );
- portRESTORE_CONTEXT( );
-}
-#endif
-
-void
-vPortEnterCritical()
-{
- /* FIXME: We should store the old IPL here - How are we supposed to do
- * this.
- */
- ( void )portSET_IPL( portIPL_MAX );
-
- /* Now interrupts are disabled ulCriticalNesting can be accessed
- * directly. Increment ulCriticalNesting to keep a count of how many times
- * portENTER_CRITICAL() has been called. */
- ulCriticalNesting++;
-}
-
-void
-vPortExitCritical()
-{
- if( ulCriticalNesting > portNO_CRITICAL_NESTING )
- {
- /* Decrement the nesting count as we are leaving a critical section. */
- ulCriticalNesting--;
-
- /* If the nesting level has reached zero then interrupts should be
- re-enabled. */
- if( ulCriticalNesting == portNO_CRITICAL_NESTING )
- {
- ( void )portSET_IPL( 0 );
- }
- }
-}
-
-portBASE_TYPE
-xPortStartScheduler( void )
-{
- extern void ( *portVECTOR_TABLE[ ] ) ( );
-
- /* Add entry in vector table for yield system call. */
- portVECTOR_TABLE[ portVECTOR_SYSCALL ] = prvPortYield;
- /* Add entry in vector table for periodic timer. */
- portVECTOR_TABLE[ portVECTOR_TIMER ] = prvPortPreemptiveTick;
-
- /* Configure the timer for the system clock. */
- if ( configTICK_RATE_HZ > 0)
- {
- /* Configure prescaler */
- MCF_PIT_PCSR0 = MCF_PIT_PCSR_PRE( 0x9 ) | MCF_PIT_PCSR_RLD | MCF_PIT_PCSR_OVW;
- /* Initialize the periodic timer interrupt. */
- MCF_PIT_PMR0 = MCF_PIT_MODULUS_REGISTER( configTICK_RATE_HZ );
- /* Configure interrupt priority and level and unmask interrupt. */
- MCF_INTC0_ICR36 = MCF_INTC0_ICRn_IL( 0x1 ) | MCF_INTC0_ICRn_IP( 0x1 );
- MCF_INTC0_IMRH &= ~( MCF_INTC0_IMRH_INT_MASK36 | MCF_INTC0_IMRH_MASKALL );
- /* Enable interrupts */
- MCF_PIT_PCSR0 |= MCF_PIT_PCSR_PIE | MCF_PIT_PCSR_EN | MCF_PIT_PCSR_PIF;
- }
-
- /* Restore the context of the first task that is going to run. */
- portRESTORE_CONTEXT( );
-
- /* Should not get here. */
- return pdTRUE;
-}
-
-void
-vPortEndScheduler( void )
-{
-}
+ with commercial development and support options.\r
+ ***************************************************************************\r
+*/\r
+\r
+#include <stdlib.h>\r
+\r
+#include "FreeRTOS.h"\r
+#include "FreeRTOSConfig.h"\r
+#include "task.h"\r
+\r
+/* ------------------------ Types ----------------------------------------- */\r
+typedef volatile unsigned long vuint32;\r
+typedef volatile unsigned short vuint16;\r
+typedef volatile unsigned char vuint8;\r
+\r
+/* ------------------------ Defines --------------------------------------- */\r
+#define portVECTOR_TABLE __RAMVEC\r
+#define portVECTOR_SYSCALL ( 32 + portTRAP_YIELD )\r
+#define portVECTOR_TIMER ( 64 + 36 )\r
+\r
+#define MCF_PIT_PRESCALER 512UL\r
+#define MCF_PIT_TIMER_TICKS ( FSYS_2 / MCF_PIT_PRESCALER )\r
+#define MCF_PIT_MODULUS_REGISTER(freq) ( MCF_PIT_TIMER_TICKS / ( freq ) - 1UL)\r
+\r
+#define MCF_PIT_PMR0 ( *( vuint16 * )( void * )( &__IPSBAR[ 0x150002 ] ) )\r
+#define MCF_PIT_PCSR0 ( *( vuint16 * )( void * )( &__IPSBAR[ 0x150000 ] ) )\r
+#define MCF_PIT_PCSR_PRE(x) ( ( ( x ) & 0x000F ) << 8 )\r
+#define MCF_PIT_PCSR_EN ( 0x0001 )\r
+#define MCF_PIT_PCSR_RLD ( 0x0002 )\r
+#define MCF_PIT_PCSR_PIF ( 0x0004 )\r
+#define MCF_PIT_PCSR_PIE ( 0x0008 )\r
+#define MCF_PIT_PCSR_OVW ( 0x0010 )\r
+#define MCF_INTC0_ICR36 ( *( vuint8 * )( void * )( &__IPSBAR[ 0x000C64 ] ) )\r
+#define MCF_INTC0_IMRH ( *( vuint32 * )( void * )( &__IPSBAR[ 0x000C08 ] ) )\r
+#define MCF_INTC0_IMRH_INT_MASK36 ( 0x00000010 )\r
+#define MCF_INTC0_IMRH_MASKALL ( 0x00000001 )\r
+#define MCF_INTC0_ICRn_IP(x) ( ( ( x ) & 0x07 ) << 0 )\r
+#define MCF_INTC0_ICRn_IL(x) ( ( ( x ) & 0x07 ) << 3 )\r
+\r
+#define portNO_CRITICAL_NESTING ( ( unsigned portLONG ) 0 )\r
+#define portINITIAL_CRITICAL_NESTING ( ( unsigned portLONG ) 10 )\r
+\r
+/* ------------------------ Static variables ------------------------------ */\r
+volatile unsigned portLONG ulCriticalNesting = portINITIAL_CRITICAL_NESTING;\r
+\r
+/* ------------------------ Static functions ------------------------------ */\r
+#if configUSE_PREEMPTION == 0\r
+static void prvPortPreemptiveTick ( void ) __attribute__ ((interrupt_handler));\r
+#else\r
+static void prvPortPreemptiveTick ( void );\r
+#endif\r
+\r
+/* ------------------------ Start implementation -------------------------- */\r
+\r
+portSTACK_TYPE *\r
+pxPortInitialiseStack( portSTACK_TYPE * pxTopOfStack, pdTASK_CODE pxCode,\r
+ void *pvParameters )\r
+{\r
+ /* Place the parameter on the stack in the expected location. */\r
+ *pxTopOfStack = ( portSTACK_TYPE ) pvParameters;\r
+ pxTopOfStack--;\r
+\r
+ /* Place dummy return address on stack. Tasks should never terminate so\r
+ * we can set this to anything. */\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0;\r
+ pxTopOfStack--;\r
+\r
+ /* Create a Motorola Coldfire exception stack frame. First comes the return\r
+ * address. */\r
+ *pxTopOfStack = ( portSTACK_TYPE ) pxCode;\r
+ pxTopOfStack--;\r
+\r
+ /* Format, fault-status, vector number for exception stack frame. Task\r
+ * run in supervisor mode. */\r
+ *pxTopOfStack = 0x40002000UL | ( portVECTOR_SYSCALL + 32 ) << 18;\r
+ pxTopOfStack--;\r
+\r
+ /* Set the initial critical section nesting counter to zero. This value\r
+ * is used to restore the value of ulCriticalNesting. */\r
+ *pxTopOfStack = 0;\r
+ *pxTopOfStack--;\r
+\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0xA6; /* A6 / FP */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0xA5; /* A5 */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0xA4; /* A4 */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0xA3; /* A3 */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0xA2; /* A2 */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0xA1; /* A1 */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0xA0; /* A0 */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0xD7; /* D7 */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0xD6; /* D6 */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0xD5; /* D5 */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0xD4; /* D4 */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0xD3; /* D3 */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0xD2; /* D2 */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0xD1; /* D1 */\r
+ pxTopOfStack--;\r
+ *pxTopOfStack = ( portSTACK_TYPE ) 0xD0; /* D0 */\r
+\r
+ return pxTopOfStack;\r
+}\r
+\r
+/*\r
+ * Called by portYIELD() or taskYIELD() to manually force a context switch.\r
+ */\r
+static void\r
+prvPortYield( void )\r
+{\r
+ asm volatile ( "move.w #0x2700, %sr\n\t" );\r
+#if _GCC_USES_FP == 1\r
+ asm volatile ( "unlk %fp\n\t" );\r
+#endif\r
+ /* Perform the context switch. First save the context of the current task. */\r
+ portSAVE_CONTEXT( );\r
+\r
+ /* Find the highest priority task that is ready to run. */\r
+ vTaskSwitchContext( );\r
+\r
+ /* Restore the context of the new task. */\r
+ portRESTORE_CONTEXT( );\r
+}\r
+\r
+#if configUSE_PREEMPTION == 0\r
+/*\r
+ * The ISR used for the scheduler tick depends on whether the cooperative or\r
+ * the preemptive scheduler is being used.\r
+ */\r
+static void\r
+prvPortPreemptiveTick ( void )\r
+{\r
+ /* The cooperative scheduler requires a normal IRQ service routine to\r
+ * simply increment the system tick.\r
+ */\r
+\r
+ vTaskIncrementTick( );\r
+ MCF_PIT_PCSR0 |= MCF_PIT_PCSR_PIF;\r
+}\r
+\r
+#else\r
+\r
+static void\r
+prvPortPreemptiveTick( void )\r
+{\r
+ asm volatile ( "move.w #0x2700, %sr\n\t" );\r
+#if _GCC_USES_FP == 1\r
+ asm volatile ( "unlk %fp\n\t" );\r
+#endif\r
+ portSAVE_CONTEXT( );\r
+ MCF_PIT_PCSR0 |= MCF_PIT_PCSR_PIF;\r
+ vTaskIncrementTick( );\r
+ vTaskSwitchContext( );\r
+ portRESTORE_CONTEXT( );\r
+}\r
+#endif\r
+\r
+void\r
+vPortEnterCritical()\r
+{\r
+ /* FIXME: We should store the old IPL here - How are we supposed to do\r
+ * this.\r
+ */\r
+ ( void )portSET_IPL( portIPL_MAX );\r
+\r
+ /* Now interrupts are disabled ulCriticalNesting can be accessed\r
+ * directly. Increment ulCriticalNesting to keep a count of how many times\r
+ * portENTER_CRITICAL() has been called. */\r
+ ulCriticalNesting++;\r
+}\r
+\r
+void\r
+vPortExitCritical()\r
+{\r
+ if( ulCriticalNesting > portNO_CRITICAL_NESTING )\r
+ {\r
+ /* Decrement the nesting count as we are leaving a critical section. */\r
+ ulCriticalNesting--;\r
+\r
+ /* If the nesting level has reached zero then interrupts should be\r
+ re-enabled. */\r
+ if( ulCriticalNesting == portNO_CRITICAL_NESTING )\r
+ {\r
+ ( void )portSET_IPL( 0 );\r
+ }\r
+ }\r
+}\r
+\r
+portBASE_TYPE\r
+xPortStartScheduler( void )\r
+{\r
+ extern void ( *portVECTOR_TABLE[ ] ) ( );\r
+\r
+ /* Add entry in vector table for yield system call. */\r
+ portVECTOR_TABLE[ portVECTOR_SYSCALL ] = prvPortYield;\r
+ /* Add entry in vector table for periodic timer. */\r
+ portVECTOR_TABLE[ portVECTOR_TIMER ] = prvPortPreemptiveTick;\r
+\r
+ /* Configure the timer for the system clock. */\r
+ if ( configTICK_RATE_HZ > 0)\r
+ {\r
+ /* Configure prescaler */\r
+ MCF_PIT_PCSR0 = MCF_PIT_PCSR_PRE( 0x9 ) | MCF_PIT_PCSR_RLD | MCF_PIT_PCSR_OVW;\r
+ /* Initialize the periodic timer interrupt. */\r
+ MCF_PIT_PMR0 = MCF_PIT_MODULUS_REGISTER( configTICK_RATE_HZ );\r
+ /* Configure interrupt priority and level and unmask interrupt. */\r
+ MCF_INTC0_ICR36 = MCF_INTC0_ICRn_IL( 0x1 ) | MCF_INTC0_ICRn_IP( 0x1 );\r
+ MCF_INTC0_IMRH &= ~( MCF_INTC0_IMRH_INT_MASK36 | MCF_INTC0_IMRH_MASKALL );\r
+ /* Enable interrupts */\r
+ MCF_PIT_PCSR0 |= MCF_PIT_PCSR_PIE | MCF_PIT_PCSR_EN | MCF_PIT_PCSR_PIF;\r
+ }\r
+\r
+ /* Restore the context of the first task that is going to run. */\r
+ portRESTORE_CONTEXT( );\r
+\r
+ /* Should not get here. */\r
+ return pdTRUE;\r
+}\r
+\r
+void\r
+vPortEndScheduler( void )\r
+{\r
+}\r
-/*
- FreeRTOS V4.1.1 - Copyright (C) 2003-2006 Richard Barry.
- MCF5235 Port - Copyright (C) 2006 Christian Walter.
-
- This file is part of the FreeRTOS distribution.
-
- FreeRTOS is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- FreeRTOS is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with FreeRTOS; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- A special exception to the GPL can be applied should you wish to distribute
- a combined work that includes FreeRTOS, without being obliged to provide
- the source code for any proprietary components. See the licensing section
- of http://www.FreeRTOS.org for full details of how and when the exception
- can be applied.
-
- ***************************************************************************
- See http://www.FreeRTOS.org for documentation, latest information, license
- and contact details. Please ensure to read the configuration and relevant
+/*\r
+ FreeRTOS V4.1.1 - Copyright (C) 2003-2006 Richard Barry.\r
+ MCF5235 Port - Copyright (C) 2006 Christian Walter.\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
Also see http://www.SafeRTOS.com for an IEC 61508 compliant version along\r
- with commercial development and support options.
- ***************************************************************************
-*/
-
-#ifndef PORTMACRO_H
-#define PORTMACRO_H
-
-/* ------------------------ Data types for Coldfire ----------------------- */
-#define portCHAR char
-#define portFLOAT float
-#define portDOUBLE double
-#define portLONG long
-#define portSHORT short
-#define portSTACK_TYPE unsigned int
-#define portBASE_TYPE int
-
-#if( USE_16_BIT_TICKS == 1 )
- typedef unsigned portSHORT portTickType;
- #define portMAX_DELAY ( portTickType ) 0xffff
-#else
- typedef unsigned portLONG portTickType;
- #define portMAX_DELAY ( portTickType ) 0xffffffff
-#endif
-
-/* ------------------------ Architecture specifics ------------------------ */
-#define portSTACK_GROWTH ( -1 )
-#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
-#define portBYTE_ALIGNMENT 4
-
-#define portTRAP_YIELD 0 /* Trap 0 */
-#define portIPL_MAX 7 /* Only NMI interrupt 7 allowed. */
-
-/* ------------------------ FreeRTOS macros for port ---------------------- */
-
-/*
- * This function must be called when the current state of the active task
- * should be stored. It must be called immediately after exception
- * processing from the CPU, i.e. there exists a Coldfire exception frame at
- * the current position in the stack. The function reserves space on
- * the stack for the CPU registers and other task dependent values (e.g
- * ulCriticalNesting) and updates the top of the stack in the TCB.
- */
-#define portSAVE_CONTEXT() \
- asm volatile ( /* reserve space for task state. */ \
- "lea.l (-64, %sp), %sp\n\t" \
- /* push data register %d0-%d7/%a0-%a6 on stack. */ \
- "movem.l %d0-%d7/%a0-%a6, (%sp)\n\t" \
- /* push ulCriticalNesting counter on stack. */ \
- "lea.l (60, %sp), %a0\n\t" \
- "move.l ulCriticalNesting, (%a0)\n\t" \
- /* set the new top of the stack in the TCB. */ \
- "move.l pxCurrentTCB, %a0\n\t" \
- "move.l %sp, (%a0)");
-
-/*.
- * This function restores the current active and continues its execution.
- * It loads the current TCB and restores the processor registers, the
- * task dependent values (e.g ulCriticalNesting). Finally execution
- * is continued by executing an rte instruction.
- */
-#define portRESTORE_CONTEXT() \
- asm volatile ( "move.l pxCurrentTCB, %sp\n\t" \
- "move.l (%sp), %sp\n\t" \
- /* stack pointer now points to the saved registers. */ \
- "movem.l (%sp), %d0-%d7/%a0-%a6\n\t" \
- /* restore ulCriticalNesting counter from stack. */ \
- "lea.l (%sp, 60), %sp\n\t" \
- "move.l (%sp)+, ulCriticalNesting\n\t" \
- /* stack pointer now points to exception frame. */ \
- "rte\n\t" );
-
-#define portENTER_CRITICAL() \
- vPortEnterCritical();
-
-#define portEXIT_CRITICAL() \
- vPortExitCritical();
-
-#define portSET_IPL( xIPL ) \
- asm_set_ipl( xIPL )
-
-#define portDISABLE_INTERRUPTS() \
- do { ( void )portSET_IPL( portIPL_MAX ); } while( 0 )
-#define portENABLE_INTERRUPTS() \
- do { ( void )portSET_IPL( 0 ); } while( 0 )
-
-#define portYIELD() \
- asm volatile ( " trap %0\n\t" : : "i"(portTRAP_YIELD) )
-
-#define portNOP() \
- asm volatile ( "nop\n\t" )
-
-#define portENTER_SWITCHING_ISR() \
- asm volatile ( "move.w #0x2700, %sr" ); \
- /* Save the context of the interrupted task. */ \
- portSAVE_CONTEXT( ); \
- {
-
-#define portEXIT_SWITCHING_ISR( SwitchRequired ) \
- /* If a switch is required we call vTaskSwitchContext(). */ \
- if( SwitchRequired ) \
- { \
- vTaskSwitchContext( ); \
- } \
- } \
- portRESTORE_CONTEXT( );
-
-/* ------------------------ Function prototypes --------------------------- */
-void vPortEnterCritical( void );
-void vPortExitCritical( void );
-int asm_set_ipl( unsigned long int uiNewIPL );
-
-/* ------------------------ Compiler specifics ---------------------------- */
-#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) \
- void vFunction( void *pvParameters )
-
-#define portTASK_FUNCTION( vFunction, pvParameters ) \
- void vFunction( void *pvParameters )
-#endif
-
+ with commercial development and support options.\r
+ ***************************************************************************\r
+*/\r
+\r
+#ifndef PORTMACRO_H\r
+#define PORTMACRO_H\r
+\r
+/* ------------------------ Data types for Coldfire ----------------------- */\r
+#define portCHAR char\r
+#define portFLOAT float\r
+#define portDOUBLE double\r
+#define portLONG long\r
+#define portSHORT short\r
+#define portSTACK_TYPE unsigned int\r
+#define portBASE_TYPE int\r
+\r
+#if( USE_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
+/* ------------------------ Architecture specifics ------------------------ */\r
+#define portSTACK_GROWTH ( -1 )\r
+#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )\r
+#define portBYTE_ALIGNMENT 4\r
+\r
+#define portTRAP_YIELD 0 /* Trap 0 */\r
+#define portIPL_MAX 7 /* Only NMI interrupt 7 allowed. */\r
+\r
+/* ------------------------ FreeRTOS macros for port ---------------------- */\r
+\r
+/*\r
+ * This function must be called when the current state of the active task\r
+ * should be stored. It must be called immediately after exception\r
+ * processing from the CPU, i.e. there exists a Coldfire exception frame at\r
+ * the current position in the stack. The function reserves space on\r
+ * the stack for the CPU registers and other task dependent values (e.g\r
+ * ulCriticalNesting) and updates the top of the stack in the TCB.\r
+ */\r
+#define portSAVE_CONTEXT() \\r
+ asm volatile ( /* reserve space for task state. */ \\r
+ "lea.l (-64, %sp), %sp\n\t" \\r
+ /* push data register %d0-%d7/%a0-%a6 on stack. */ \\r
+ "movem.l %d0-%d7/%a0-%a6, (%sp)\n\t" \\r
+ /* push ulCriticalNesting counter on stack. */ \\r
+ "lea.l (60, %sp), %a0\n\t" \\r
+ "move.l ulCriticalNesting, (%a0)\n\t" \\r
+ /* set the new top of the stack in the TCB. */ \\r
+ "move.l pxCurrentTCB, %a0\n\t" \\r
+ "move.l %sp, (%a0)");\r
+\r
+/*.\r
+ * This function restores the current active and continues its execution.\r
+ * It loads the current TCB and restores the processor registers, the\r
+ * task dependent values (e.g ulCriticalNesting). Finally execution\r
+ * is continued by executing an rte instruction.\r
+ */\r
+#define portRESTORE_CONTEXT() \\r
+ asm volatile ( "move.l pxCurrentTCB, %sp\n\t" \\r
+ "move.l (%sp), %sp\n\t" \\r
+ /* stack pointer now points to the saved registers. */ \\r
+ "movem.l (%sp), %d0-%d7/%a0-%a6\n\t" \\r
+ /* restore ulCriticalNesting counter from stack. */ \\r
+ "lea.l (%sp, 60), %sp\n\t" \\r
+ "move.l (%sp)+, ulCriticalNesting\n\t" \\r
+ /* stack pointer now points to exception frame. */ \\r
+ "rte\n\t" );\r
+\r
+#define portENTER_CRITICAL() \\r
+ vPortEnterCritical();\r
+\r
+#define portEXIT_CRITICAL() \\r
+ vPortExitCritical();\r
+\r
+#define portSET_IPL( xIPL ) \\r
+ asm_set_ipl( xIPL )\r
+\r
+#define portDISABLE_INTERRUPTS() \\r
+ do { ( void )portSET_IPL( portIPL_MAX ); } while( 0 )\r
+#define portENABLE_INTERRUPTS() \\r
+ do { ( void )portSET_IPL( 0 ); } while( 0 )\r
+\r
+#define portYIELD() \\r
+ asm volatile ( " trap %0\n\t" : : "i"(portTRAP_YIELD) )\r
+\r
+#define portNOP() \\r
+ asm volatile ( "nop\n\t" )\r
+\r
+#define portENTER_SWITCHING_ISR() \\r
+ asm volatile ( "move.w #0x2700, %sr" ); \\r
+ /* Save the context of the interrupted task. */ \\r
+ portSAVE_CONTEXT( ); \\r
+ {\r
+\r
+#define portEXIT_SWITCHING_ISR( SwitchRequired ) \\r
+ /* If a switch is required we call vTaskSwitchContext(). */ \\r
+ if( SwitchRequired ) \\r
+ { \\r
+ vTaskSwitchContext( ); \\r
+ } \\r
+ } \\r
+ portRESTORE_CONTEXT( );\r
+\r
+/* ------------------------ Function prototypes --------------------------- */\r
+void vPortEnterCritical( void );\r
+void vPortExitCritical( void );\r
+int asm_set_ipl( unsigned long int uiNewIPL );\r
+\r
+/* ------------------------ Compiler specifics ---------------------------- */\r
+#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) \\r
+ void vFunction( void *pvParameters )\r
+\r
+#define portTASK_FUNCTION( vFunction, pvParameters ) \\r
+ void vFunction( void *pvParameters )\r
+#endif\r
+\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
\r
\r
/* Setup the FreeRTOS interrupt handler. Code copied from crt0.s. */\r
- asm volatile ( "la r6, r0, __FreeRTOS_interrupt_handler \n\t" \
- "sw r6, r1, r0 \n\t" \
- "lhu r7, r1, r0 \n\t" \
- "shi r7, r0, 0x12 \n\t" \
+ asm volatile ( "la r6, r0, __FreeRTOS_interrupt_handler \n\t" \\r
+ "sw r6, r1, r0 \n\t" \\r
+ "lhu r7, r1, r0 \n\t" \\r
+ "shi r7, r0, 0x12 \n\t" \\r
"shi r6, r0, 0x16 " );\r
\r
/* Setup the hardware to generate the tick. Interrupts are disabled when\r
*/\r
void vTaskISRHandler( void )\r
{\r
-static unsigned portLONG ulPending;
+static unsigned portLONG ulPending; \r
\r
- /* Which interrupts are pending? */
- ulPending = XIntc_In32( ( XPAR_INTC_SINGLE_BASEADDR + XIN_IVR_OFFSET ) );
+ /* Which interrupts are pending? */\r
+ ulPending = XIntc_In32( ( XPAR_INTC_SINGLE_BASEADDR + XIN_IVR_OFFSET ) );\r
\r
if( ulPending < XPAR_INTC_MAX_NUM_INTR_INPUTS )\r
{\r
\r
ulInterruptMask = ( unsigned portLONG ) 1 << ulPending;\r
\r
- /* Get the configuration data using the device ID */
+ /* Get the configuration data using the device ID */\r
pxConfig = &XIntc_ConfigTable[ ( unsigned portLONG ) XPAR_INTC_SINGLE_DEVICE_ID ];\r
\r
pxTablePtr = &( pxConfig->HandlerTable[ ulPending ] );\r
- if( pxConfig->AckBeforeService & ( ulInterruptMask ) )
- {
+ if( pxConfig->AckBeforeService & ( ulInterruptMask ) )\r
+ {\r
XIntc_mAckIntr( pxConfig->BaseAddress, ulInterruptMask );\r
- pxTablePtr->Handler( pxTablePtr->CallBackRef );
+ pxTablePtr->Handler( pxTablePtr->CallBackRef );\r
}\r
- else
+ else\r
{\r
- pxTablePtr->Handler( pxTablePtr->CallBackRef );
- XIntc_mAckIntr( pxConfig->BaseAddress, ulInterruptMask );
+ pxTablePtr->Handler( pxTablePtr->CallBackRef );\r
+ XIntc_mAckIntr( pxConfig->BaseAddress, ulInterruptMask );\r
}\r
}\r
}\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\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
+ 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
+ See http://www.FreeRTOS.org for documentation, latest information, license\r
+ and contact details. Please ensure to read the configuration and relevant\r
port sections of the online documentation.\r
\r
Also see http://www.SafeRTOS.com for an IEC 61508 compliant version along\r
***************************************************************************\r
*/\r
\r
+/*\r
+ Change from V4.2.1:\r
+\r
+ + Introduced usage of configKERNEL_INTERRUPT_PRIORITY macro to set the\r
+ interrupt priority used by the kernel.\r
+*/\r
\r
/*-----------------------------------------------------------\r
* Implementation of functions defined in portable.h for the ARM CM3 port.\r
#define portNVIC_SYSTICK_INT 0x00000002\r
#define portNVIC_SYSTICK_ENABLE 0x00000001\r
#define portNVIC_PENDSVSET 0x10000000\r
-#define portNVIC_PENDSV_PRI 0x00ff0000\r
-#define portNVIC_SVCALL_PRI 0xff000000\r
-#define portNVIC_SYSTICK_PRI 0xff000000\r
+#define portNVIC_PENDSV_PRI ( ( ( unsigned portLONG ) configKERNEL_INTERRUPT_PRIORITY ) << 16 )\r
+#define portNVIC_SYSTICK_PRI ( ( ( unsigned portLONG ) configKERNEL_INTERRUPT_PRIORITY ) << 24 )\r
\r
/* Constants required to set up the initial stack. */\r
#define portINITIAL_XPSR ( 0x01000000 )\r
\r
+/* For backward compatibility, ensure configKERNEL_INTERRUPT_PRIORITY is \r
+defined. The value zero should also ensure backward compatibility. \r
+FreeRTOS.org versions prior to V4.3.0 did not include this definition. */\r
+#ifndef configKERNEL_INTERRUPT_PRIORITY\r
+ #define configKERNEL_INTERRUPT_PRIORITY 255\r
+#endif\r
+\r
/* Each task maintains its own interrupt status in the critical nesting\r
variable. */\r
unsigned portBASE_TYPE uxCriticalNesting = 0xaaaaaaaa;\r
\r
-/* \r
+/*\r
* Setup the timer to generate the tick interrupts.\r
*/\r
static void prvSetupTimerInterrupt( void );\r
\r
/*-----------------------------------------------------------*/\r
\r
-/* \r
- * See header file for description. \r
+/*\r
+ * See header file for description.\r
*/\r
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )\r
{\r
}\r
/*-----------------------------------------------------------*/\r
\r
-/* \r
- * See header file for description. \r
+/*\r
+ * See header file for description.\r
*/\r
portBASE_TYPE xPortStartScheduler( void )\r
{\r
- /* Make PendSV, CallSV and SysTick the lowest priority interrupts. */\r
+ /* Make PendSV and SysTick the lowest priority interrupts. */\r
*(portNVIC_SYSPRI2) |= portNVIC_PENDSV_PRI;\r
*(portNVIC_SYSPRI2) |= portNVIC_SYSTICK_PRI;\r
\r
*(portNVIC_SYSTICK_LOAD) = configCPU_CLOCK_HZ / configTICK_RATE_HZ;\r
*(portNVIC_SYSTICK_CTRL) = portNVIC_SYSTICK_CLK | portNVIC_SYSTICK_INT | portNVIC_SYSTICK_ENABLE;\r
}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vPortSwitchContext( void )\r
+{\r
+ vPortSetInterruptMask();\r
+ vTaskSwitchContext();\r
+ vPortClearInterruptMask();\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vPortIncrementTick( void )\r
+{\r
+ vPortSetInterruptMask();\r
+ vTaskIncrementTick();\r
+ vPortClearInterruptMask();\r
+}\r
\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\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
+ 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
+ See http://www.FreeRTOS.org for documentation, latest information, license\r
+ and contact details. Please ensure to read the configuration and relevant\r
port sections of the online documentation.\r
\r
Also see http://www.SafeRTOS.com for an IEC 61508 compliant version along\r
with commercial development and support options.\r
***************************************************************************\r
*/\r
+\r
+/*\r
+ Change from V4.2.1:\r
+\r
+ + Introduced usage of configKERNEL_INTERRUPT_PRIORITY macro to set the\r
+ interrupt priority used by the kernel.\r
+*/\r
+\r
#include <FreeRTOSConfig.h>\r
+\r
+/* For backward compatibility, ensure configKERNEL_INTERRUPT_PRIORITY is \r
+defined. The value zero should also ensure backward compatibility. \r
+FreeRTOS.org versions prior to V4.3.0 did not include this definition. */\r
+#ifndef configKERNEL_INTERRUPT_PRIORITY\r
+ #define configKERNEL_INTERRUPT_PRIORITY 0\r
+#endif\r
+\r
\r
RSEG ICODE:CODE\r
\r
EXTERN vPortYieldFromISR\r
- EXTERN vTaskSwitchContext\r
- EXTERN vTaskIncrementTick\r
+ EXTERN vPortSwitchContext\r
+ EXTERN vPortIncrementTick\r
EXTERN uxCriticalNesting\r
EXTERN pxCurrentTCB\r
\r
PUBLIC vSetMSP\r
PUBLIC xPortPendSVHandler\r
PUBLIC xPortSysTickHandler\r
+ PUBLIC vPortSetInterruptMask\r
+ PUBLIC vPortClearInterruptMask\r
\r
\r
vSetPSP:\r
msr psp, r0\r
bx lr\r
+ \r
/*-----------------------------------------------------------*/\r
\r
vSetMSP\r
msr msp, r0\r
bx lr\r
+ \r
/*-----------------------------------------------------------*/\r
\r
xPortPendSVHandler:\r
ldr r1, [r1]\r
str r0, [r1]\r
no_save:\r
- ldr r0, =vTaskSwitchContext\r
+ ldr r0, =vPortSwitchContext\r
push {r14}\r
- cpsid i\r
blx r0\r
- cpsie i\r
pop {r14}\r
\r
/* Restore the context. */ \r
bx r14\r
\r
sv_disable_interrupts:\r
- cpsid i\r
+ mov r1, #configKERNEL_INTERRUPT_PRIORITY\r
+ msr basepri, R1\r
+\r
bx r14\r
\r
/*-----------------------------------------------------------*/\r
\r
xPortSysTickHandler:\r
/* Call the scheduler tick function. */\r
- ldr r0, =vTaskIncrementTick\r
+ ldr r0, =vPortIncrementTick\r
push {r14}\r
- cpsid i\r
blx r0\r
- cpsie i\r
- pop {r14} \r
+ pop {r14}\r
\r
/* If using preemption, also force a context switch. */\r
#if configUSE_PREEMPTION == 1\r
push {r14}\r
ldr r0, =vPortYieldFromISR\r
blx r0\r
- pop {r14} \r
+ pop {r14}\r
#endif\r
\r
/* Exit with interrupts in the correct state. */\r
ldr r2, =uxCriticalNesting\r
ldr r2, [r2]\r
cbnz r2, tick_disable_interrupts\r
- bx r14 \r
+ bx r14\r
\r
tick_disable_interrupts:\r
- cpsid i\r
+ mov r1, #configKERNEL_INTERRUPT_PRIORITY\r
+ msr basepri, R1\r
+ \r
bx r14\r
\r
- END\r
/*-----------------------------------------------------------*/\r
+\r
+vPortSetInterruptMask:\r
+ push { r0 }\r
+ mov R0, #configKERNEL_INTERRUPT_PRIORITY\r
+ msr BASEPRI, R0\r
+ pop { R0 }\r
+\r
+ bx r14\r
+ \r
+/*-----------------------------------------------------------*/\r
+\r
+vPortClearInterruptMask:\r
+ PUSH { r0 }\r
+ MOV R0, #0\r
+ MSR BASEPRI, R0\r
+ POP { R0 }\r
+\r
+ bx r14\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+ END\r
+
\ No newline at end of file
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\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
+ 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
+ See http://www.FreeRTOS.org for documentation, latest information, license\r
+ and contact details. Please ensure to read the configuration and relevant\r
port sections of the online documentation.\r
\r
Also see http://www.SafeRTOS.com for an IEC 61508 compliant version along\r
***************************************************************************\r
*/\r
\r
+/*\r
+ Change from V4.2.1:\r
+\r
+ + Introduced usage of configKERNEL_INTERRUPT_PRIORITY macro to set the\r
+ interrupt priority used by the kernel.\r
+*/\r
+\r
\r
#ifndef PORTMACRO_H\r
#define PORTMACRO_H\r
\r
/*-----------------------------------------------------------\r
- * Port specific definitions. \r
+ * Port specific definitions.\r
*\r
* The settings in this file configure FreeRTOS correctly for the\r
* given hardware and compiler.\r
extern void vPortEnableInterrupts( void );\r
extern void vPortEnterCritical( void );\r
extern void vPortExitCritical( void );\r
+extern void vPortSetInterruptMask( void );\r
+extern void vPortClearInterruptMask( void );\r
\r
-#define portDISABLE_INTERRUPTS() __asm ( "cpsid i" )\r
-#define portENABLE_INTERRUPTS() __asm ( "cpsie i" )\r
+#define portDISABLE_INTERRUPTS() vPortSetInterruptMask();\r
+#define portENABLE_INTERRUPTS() vPortClearInterruptMask();\r
#define portENTER_CRITICAL() vPortEnterCritical()\r
#define portEXIT_CRITICAL() vPortExitCritical()\r
/*-----------------------------------------------------------*/\r
#define inline\r
#define portNOP()\r
\r
+\r
#endif /* PORTMACRO_H */\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
-; FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+; FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
;\r
; This file is part of the FreeRTOS.org distribution.\r
;\r
*****************************************************************************/\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
*****************************************************************************/\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
-; FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+; FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
;\r
; This file is part of the FreeRTOS.org distribution.\r
;\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
-; FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+; FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
;\r
; This file is part of the FreeRTOS.org distribution.\r
;\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
save the context with interrupts enabled. */\r
portSAVE_CONTEXT( portGLOBAL_INTERRUPT_FLAG );\r
PIR1bits.CCP1IF = 0;\r
-
+\r
/* Maintain the tick count. */\r
vTaskIncrementTick();\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
***************************************************************************\r
*/\r
\r
+/*\r
+ Changes from V4.2.1\r
+\r
+ + Introduced the configKERNEL_INTERRUPT_PRIORITY definition.\r
+*/\r
+\r
/*-----------------------------------------------------------\r
* Implementation of functions defined in portable.h for the PIC24 port.\r
*----------------------------------------------------------*/\r
#define portTIMER_PRESCALE 8\r
#define portINITIAL_SR 0\r
\r
+/* Defined for backward compatability with project created prior to \r
+FreeRTOS.org V4.3.0. */\r
+#ifndef configKERNEL_INTERRUPT_PRIORITY\r
+ #define configKERNEL_INTERRUPT_PRIORITY 1\r
+#endif\r
+\r
/* The program counter is only 23 bits. */\r
#define portUNUSED_PR_BITS 0x7f\r
\r
/* Records the nesting depth of calls to portENTER_CRITICAL(). */\r
unsigned portBASE_TYPE uxCriticalNesting = 0xef;\r
\r
+#if configKERNEL_INTERRUPT_PRIORITY != 1\r
+ #error If configKERNEL_INTERRUPT_PRIORITY is not 1 then the #32 in the following macros needs changing to equal the portINTERRUPT_BITS value, which is ( configKERNEL_INTERRUPT_PRIORITY << 5 )\r
+#endif\r
+\r
#ifdef MPLAB_PIC24_PORT\r
\r
#define portRESTORE_CONTEXT() \\r
#define portSAVE_CONTEXT() \\r
asm volatile( "PUSH SR \n" /* Save the SR used by the task.... */ \\r
"PUSH W0 \n" /* ....then disable interrupts. */ \\r
- "MOV #224, W0 \n" \\r
+ "MOV #32, W0 \n" \\r
"MOV W0, SR \n" \\r
"PUSH W1 \n" /* Save registers to the stack. */ \\r
"PUSH.D W2 \n" \\r
#define portSAVE_CONTEXT() \\r
asm volatile( "PUSH SR \n" /* Save the SR used by the task.... */ \\r
"PUSH W0 \n" /* ....then disable interrupts. */ \\r
- "MOV #224, W0 \n" \\r
+ "MOV #32, W0 \n" \\r
"MOV W0, SR \n" \\r
"PUSH W1 \n" /* Save registers to the stack. */ \\r
"PUSH.D W2 \n" \\r
PR1 = ( unsigned portSHORT ) ulCompareMatch;\r
\r
/* Setup timer 1 interrupt priority. */\r
- IPC0bits.T1IP = portKERNEL_INTERRUPT_PRIORITY;\r
+ IPC0bits.T1IP = configKERNEL_INTERRUPT_PRIORITY;\r
\r
/* Clear the interrupt as a starting condition. */\r
IFS0bits.T1IF = 0;\r
}\r
/*-----------------------------------------------------------*/\r
\r
-void __attribute__((__interrupt__)) _T1Interrupt( void )\r
+void __attribute__((__interrupt__, auto_psv)) _T1Interrupt( void )\r
{\r
vTaskIncrementTick();\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
#define portBYTE_ALIGNMENT 2\r
#define portSTACK_GROWTH 1\r
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ ) \r
-#define portKERNEL_INTERRUPT_PRIORITY 0x01\r
/*-----------------------------------------------------------*/\r
\r
/* Critical section management. */\r
-#define portINTERRUPT_BITS ( 0x00e0 )\r
-#define portDISABLE_INTERRUPTS() SR |= portINTERRUPT_BITS\r
+#define portINTERRUPT_BITS ( ( unsigned portSHORT ) configKERNEL_INTERRUPT_PRIORITY << ( unsigned portSHORT ) 5 )\r
+\r
+#define portDISABLE_INTERRUPTS() SR |= portINTERRUPT_BITS \r
#define portENABLE_INTERRUPTS() SR &= ~portINTERRUPT_BITS\r
\r
/* Note that exiting a critical sectino will set the IPL bits to 0, nomatter\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/* \r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
*/\r
\r
/*\r
-Changes from V4.2.1\r
- + CallReturn Depth increased from 10 to 12 levels to accomodate wizC/fedC V14.\r
- +CodeOptions added to disable the wizC/fedC optimiser within asm\r
-\r
Changes from V3.2.1\r
+ CallReturn Depth increased from 8 to 10 levels to accomodate wizC/fedC V12.\r
\r
#define portSTACK_CALLRETURN_ENTRY_SIZE ( 2 )\r
#endif\r
\r
-#define portSTACK_MINIMAL_CALLRETURN_DEPTH ( 12 )\r
+#define portSTACK_MINIMAL_CALLRETURN_DEPTH ( 10 )\r
#define portSTACK_OTHER_BYTES ( 20 )\r
\r
unsigned portSHORT usCalcMinStackSize = 0;\r
* We do this here already to avoid W-register conflicts.\r
*/\r
_Pragma("asm")\r
- dupmodoff\r
movlw OVERHEADPAGE0-LOCOPTSIZE+MAXLOCOPTSIZE\r
movwf PRODL,ACCESS ; PRODL is used as temp register\r
- dupmodon\r
_Pragma("asmend")\r
ucScratch = PRODL;\r
\r
* Fetch the size of compiler's scratchspace.\r
*/\r
_Pragma("asm")\r
- dupmodoff\r
movlw OVERHEADPAGE0-LOCOPTSIZE+MAXLOCOPTSIZE\r
movlb usCalcMinStackSize>>8\r
movwf usCalcMinStackSize,BANKED\r
- dupmodon\r
_Pragma("asmend")\r
\r
/*\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
portDISABLE_INTERRUPTS(); \\r
\\r
_Pragma("asm") \\r
- dupmodoff \\r
; \\r
; Push the relevant SFR's onto the task's stack \\r
; \\r
movff pxCurrentTCB+1,FSR0H \\r
movff FSR2L,POSTINC0 \\r
movff FSR2H,POSTINC0 \\r
- dupmodon \\r
_Pragma("asmend") \\r
} while(0)\r
\r
do \\r
{ \\r
_Pragma("asm") \\r
- dupmodoff \\r
; \\r
; Set FSR0 to point to pxCurrentTCB->pxTopOfStack. \\r
; \\r
movff PREINC2,WREG \\r
movff PREINC2,STATUS \\r
return 0 ; Return without affecting interrupts \\r
- dupmodon \\r
_Pragma("asmend") \\r
} while(0)\r
\r
#define portYIELD() vPortYield()\r
\r
#define portNOP() _Pragma("asm") \\r
- dupmodoff \\r
nop \\r
- dupmodon \\r
_Pragma("asmend")\r
\r
/*-----------------------------------------------------------*/\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r
/*\r
- FreeRTOS.org V4.2.1 - Copyright (C) 2003-2007 Richard Barry.\r
+ FreeRTOS.org V4.3.0 - Copyright (C) 2003-2007 Richard Barry.\r
\r
This file is part of the FreeRTOS.org distribution.\r
\r