]> git.sur5r.net Git - freertos/commitdiff
Modify the GCC/AVR port to make use of the xTaskIncrementTick return value.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Tue, 11 Jun 2013 20:15:15 +0000 (20:15 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Tue, 11 Jun 2013 20:15:15 +0000 (20:15 +0000)
Add pre-processor directives in the dsPIC and PIC24 port layers that allows both port files to be included in the same project.

git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1932 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

FreeRTOS/Source/portable/IAR/ATMega323/portmacro.h
FreeRTOS/Source/portable/IAR/ATMega323/portmacro.s90
FreeRTOS/Source/portable/MPLAB/PIC24_dsPIC/port.c
FreeRTOS/Source/portable/MPLAB/PIC24_dsPIC/portasm_PIC24.S
FreeRTOS/Source/portable/MPLAB/PIC24_dsPIC/portasm_dsPIC.S

index 441577cc8f59b86a8e9ef1bb46e0f351861cf7fa..74e2ff486fbd356e969365edd0f9a6566032e8d9 100644 (file)
     ***************************************************************************\r
 \r
 \r
-    http://www.FreeRTOS.org - Documentation, books, training, latest versions, \r
+    http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
     license and Real Time Engineers Ltd. contact details.\r
 \r
     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
     including FreeRTOS+Trace - an indispensable productivity tool, and our new\r
     fully thread aware and reentrant UDP/IP stack.\r
 \r
-    http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High \r
-    Integrity Systems, who sell the code with commercial support, \r
+    http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
+    Integrity Systems, who sell the code with commercial support,\r
     indemnification and middleware, under the OpenRTOS brand.\r
-    \r
-    http://www.SafeRTOS.com - High Integrity Systems also provide a safety \r
-    engineered and independently SIL3 certified version for use in safety and \r
+\r
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+    engineered and independently SIL3 certified version for use in safety and\r
     mission critical applications that require provable dependability.\r
 */\r
 \r
@@ -104,6 +104,7 @@ extern "C" {
 #define portSHORT              int\r
 #define portSTACK_TYPE unsigned portCHAR\r
 #define portBASE_TYPE  portCHAR\r
+#define portPOINTER_SIZE_TYPE unsigned short\r
 \r
 #if( configUSE_16_BIT_TICKS == 1 )\r
        typedef unsigned portSHORT portTickType;\r
@@ -113,7 +114,7 @@ extern "C" {
        #define portMAX_DELAY ( portTickType ) 0xffffffff\r
 #endif\r
 \r
-/*-----------------------------------------------------------*/        \r
+/*-----------------------------------------------------------*/\r
 \r
 /* Critical section management. */\r
 extern void vPortEnterCritical( void );\r
@@ -127,7 +128,7 @@ extern void vPortExitCritical( void );
 \r
 /* Architecture specifics. */\r
 #define portSTACK_GROWTH                       ( -1 )\r
-#define portTICK_RATE_MS                       ( ( portTickType ) 1000 / configTICK_RATE_HZ )          \r
+#define portTICK_RATE_MS                       ( ( portTickType ) 1000 / configTICK_RATE_HZ )\r
 #define portBYTE_ALIGNMENT                     1\r
 #define portNOP()                                      asm( "nop" )\r
 /*-----------------------------------------------------------*/\r
index 7e892caf715af07c2ffa436b6654bfd7c7768ccf..b67705dac2a8eb5f1baa3a0b6a24aac4f712df3f 100644 (file)
@@ -1,6 +1,6 @@
 ;/*\r
 ;    FreeRTOS V7.4.2 - Copyright (C) 2013 Real Time Engineers Ltd.\r
-;      \r
+;\r
 ;\r
 ;    ***************************************************************************\r
 ;     *                                                                       *\r
@@ -103,7 +103,7 @@ PUBLIC vPortStart
        ORG USART_UDRE_vect                                     ; Vector address\r
                jmp SIG_UART_DATA                               ; ISR\r
 \r
-       \r
+\r
        RSEG CODE\r
 \r
 \r
@@ -222,7 +222,7 @@ portRESTORE_CONTEXT MACRO
        out SREG, r0\r
 \r
        ld      r0, y+                                  ; Finally we have finished with r0, so restore r0.\r
-       \r
+\r
        ENDM\r
 \r
 \r
@@ -244,7 +244,10 @@ vPortYield:
 vPortYieldFromTick:\r
        portSAVE_CONTEXT                        ; Save the context of the current task.\r
        call xTaskIncrementTick         ; Call the timer tick function.\r
+       tst r16\r
+       breq SkipTaskSwitch\r
        call vTaskSwitchContext         ; Call the scheduler.\r
+SkipTaskSwitch:\r
        portRESTORE_CONTEXT                     ; Restore the context of whichever task the ...\r
        ret                                                     ; ... scheduler decided should run.\r
 \r
index d326508c1c8e154619b6bb956a6a1b7259a39a22..8e14b87f30a593051e461b9583e7ed45f77e6e34 100644 (file)
@@ -157,7 +157,7 @@ unsigned portBASE_TYPE uxCriticalNesting = 0xef;
                #endif /* __HAS_EDS__ */\r
 #endif /* MPLAB_PIC24_PORT */\r
 \r
-#if defined( __dsPIC30F__ ) || defined ( __dsPIC33E__ ) || defined( __dsPIC33F__ )\r
+#if defined( __dsPIC30F__ ) || defined( __dsPIC33F__ )\r
 \r
        #define portRESTORE_CONTEXT()                                                                                                                                                                           \\r
                asm volatile(   "MOV    _pxCurrentTCB, W0               \n"     /* Restore the stack pointer for the task. */                           \\r
index 60144128d19b8a9ced6940a7856333fae266fa2f..738c7d2ab54cbb68f77bb4849c05cfaf604eeb1b 100644 (file)
@@ -72,6 +72,8 @@
     mission critical applications that require provable dependability.\r
 */\r
 \r
+#if defined( __PIC24E__ ) || defined ( __PIC24F__ ) || defined( __PIC24FK__ ) || defined( __PIC24H__ )\r
+\r
         .global _vPortYield\r
                .extern _vTaskSwitchContext\r
                .extern uxCriticalNesting\r
@@ -133,3 +135,5 @@ _vPortYield:
         return\r
 \r
         .end\r
+               \r
+#endif /* defined( __PIC24E__ ) || defined ( __PIC24F__ ) || defined( __PIC24FK__ ) || defined( __PIC24H__ ) */
\ No newline at end of file
index ce0fbfe5f0e1d28c1116c7bd9208fe1f2558403f..f39d203fd1842aeb2b8a2f9475ced5e1ceed7cd7 100644 (file)
     ***************************************************************************\r
 \r
 \r
-    http://www.FreeRTOS.org - Documentation, books, training, latest versions, \r
+    http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
     license and Real Time Engineers Ltd. contact details.\r
 \r
     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
     including FreeRTOS+Trace - an indispensable productivity tool, and our new\r
     fully thread aware and reentrant UDP/IP stack.\r
 \r
-    http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High \r
-    Integrity Systems, who sell the code with commercial support, \r
+    http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
+    Integrity Systems, who sell the code with commercial support,\r
     indemnification and middleware, under the OpenRTOS brand.\r
-    \r
-    http://www.SafeRTOS.com - High Integrity Systems also provide a safety \r
-    engineered and independently SIL3 certified version for use in safety and \r
+\r
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+    engineered and independently SIL3 certified version for use in safety and\r
     mission critical applications that require provable dependability.\r
 */\r
 \r
+#if defined( __dsPIC30F__ ) || defined( __dsPIC33F__ )\r
+\r
         .global _vPortYield\r
                .extern _vTaskSwitchContext\r
                .extern uxCriticalNesting\r
@@ -103,8 +105,8 @@ _vPortYield:
                PUSH    DOSTARTH\r
                PUSH    DOENDL\r
                PUSH    DOENDH\r
-               \r
-                                                                                                                                                                               \r
+\r
+\r
                PUSH    CORCON\r
                PUSH    PSVPAG\r
                MOV             _uxCriticalNesting, W0          /* Save the critical nesting counter for the task. */\r
@@ -146,3 +148,6 @@ _vPortYield:
         return\r
 \r
         .end\r
+\r
+#endif /* defined( __dsPIC30F__ ) || defined( __dsPIC33F__ ) */\r
+\r