]> git.sur5r.net Git - freertos/commitdiff
Reverse order of projdefs.h and FreeRTOSConfig.h includes in FreeRTOS.h to allow...
authorrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Wed, 4 Jun 2014 09:17:14 +0000 (09:17 +0000)
committerrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Wed, 4 Jun 2014 09:17:14 +0000 (09:17 +0000)
Update RXv2 GCC port to match RXv2 Renesas port.

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

FreeRTOS/Source/include/FreeRTOS.h
FreeRTOS/Source/include/projdefs.h
FreeRTOS/Source/portable/GCC/RX600v2/port.c
FreeRTOS/Source/portable/Renesas/RX600v2/port.c

index cebf8827e4c50aab44f35c3f908018d0593f3e5a..7b67af33a05f7f6af91f0d01ea0f8c6532857cf4 100644 (file)
 extern "C" {\r
 #endif\r
 \r
-/* Basic FreeRTOS definitions. */\r
-#include "projdefs.h"\r
-\r
 /* Application specific configuration options. */\r
 #include "FreeRTOSConfig.h"\r
 \r
+/* Basic FreeRTOS definitions. */\r
+#include "projdefs.h"\r
+\r
 /* configUSE_PORT_OPTIMISED_TASK_SELECTION must be defined before portable.h\r
 is included as it is used by the port layer. */\r
 #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION\r
index 1d8aa8206b96ba0b0f608f28529345e973e22fec..2d12bd71981f61eaf6e06d0c6ec4a2cf552aa193 100644 (file)
@@ -72,6 +72,9 @@
  */\r
 typedef void (*TaskFunction_t)( void * );\r
 \r
+/* Converts a time in miliseconds to a time in ticks. */\r
+#define pdMS_TO_TICKS( xTimeInMs ) ( ( ( TickType_t ) xTimeInMs * configTICK_RATE_HZ ) / ( TickType_t ) 1000 )\r
+\r
 #define pdFALSE                        ( ( BaseType_t ) 0 )\r
 #define pdTRUE                 ( ( BaseType_t ) 1 )\r
 \r
index ab7e0e3071b77898a96b7925f45712ccf4c43045..093ea85a301e6df126197f568d5b1a22464fbe36 100644 (file)
@@ -74,9 +74,6 @@
 /* Library includes. */\r
 #include "string.h"\r
 \r
-/* Hardware specifics. */\r
-#include "iodefine.h"\r
-\r
 /*-----------------------------------------------------------*/\r
 \r
 /* Tasks should start with interrupts enabled and in Supervisor mode, therefore\r
@@ -89,8 +86,8 @@ xTaskIncrementTick(), which is only ever called from interrupts at the kernel
 priority - ie a known priority.  Therefore these local macros are a slight\r
 optimisation compared to calling the global SET/CLEAR_INTERRUPT_MASK macros,\r
 which would require the old IPL to be read first and stored in a local variable. */\r
-#define portDISABLE_INTERRUPTS_FROM_KERNEL_ISR()       __asm volatile ( "MVTIPL        %0" ::"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY) )\r
-#define portENABLE_INTERRUPTS_FROM_KERNEL_ISR()        __asm volatile ( "MVTIPL        %0" ::"i"(configKERNEL_INTERRUPT_PRIORITY) )\r
+#define portMASK_INTERRUPTS_FROM_KERNEL_ISR()  __asm volatile ( "MVTIPL        %0" ::"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY) )\r
+#define portUNMASK_INTERRUPTS_FROM_KERNEL_ISR()        __asm volatile ( "MVTIPL        %0" ::"i"(configKERNEL_INTERRUPT_PRIORITY) )\r
 \r
 /*-----------------------------------------------------------*/\r
 \r
@@ -176,9 +173,17 @@ StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t px
        pxTopOfStack--;\r
        *pxTopOfStack = portINITIAL_FPSW;\r
        pxTopOfStack--;\r
-       *pxTopOfStack = 0x12345678; /* Accumulator. */\r
+       *pxTopOfStack = 0x11111111; /* Accumulator 0. */\r
+       pxTopOfStack--;\r
+       *pxTopOfStack = 0x22222222; /* Accumulator 0. */\r
+       pxTopOfStack--;\r
+       *pxTopOfStack = 0x33333333; /* Accumulator 0. */\r
+       pxTopOfStack--;\r
+       *pxTopOfStack = 0x44444444; /* Accumulator 1. */\r
        pxTopOfStack--;\r
-       *pxTopOfStack = 0x87654321; /* Accumulator. */\r
+       *pxTopOfStack = 0x55555555; /* Accumulator 1. */\r
+       pxTopOfStack--;\r
+       *pxTopOfStack = 0x66666666; /* Accumulator 1. */\r
 \r
        return pxTopOfStack;\r
 }\r
@@ -242,11 +247,27 @@ static void prvStartFirstTask( void )
            "POP                R15                                             \n" \\r
 \r
                /* Accumulator low 32 bits. */\r
-           "MVTACLO    R15                                     \n" \\r
+           "MVTACLO    R15, A0                                 \n" \\r
+           "POP                R15                                             \n" \\r
+\r
+           /* Accumulator high 32 bits. */\r
+           "MVTACHI    R15, A0                                 \n" \\r
            "POP                R15                                             \n" \\r
 \r
-               /* Accumulator high 32 bits. */\r
-           "MVTACHI    R15                                     \n" \\r
+           /* Accumulator guard. */\r
+           "MVTACGU    R15, A0                                 \n" \\r
+           "POP                R15                                             \n" \\r
+\r
+           /* Accumulator low 32 bits. */\r
+           "MVTACLO    R15, A1                                 \n" \\r
+           "POP                R15                                             \n" \\r
+\r
+           /* Accumulator high 32 bits. */\r
+           "MVTACHI    R15, A1                                 \n" \\r
+           "POP                R15                                             \n" \\r
+\r
+           /* Accumulator guard. */\r
+           "MVTACGU    R15, A1                                 \n" \\r
            "POP                R15                                             \n" \\r
 \r
                /* Floating point status word. */\r
@@ -300,14 +321,19 @@ void vSoftwareInterruptISR( void )
                /* Save the FPSW and accumulator. */\r
                "MVFC           FPSW, R15                                       \n" \\r
                "PUSH.L         R15                                                     \n" \\r
-               "MVFACHI        R15                                                     \n" \\r
+               "MVFACGU        #0, A1, R15                                     \n" \\r
                "PUSH.L         R15                                                     \n" \\r
-\r
-               /* Middle word. */\r
-               "MVFACMI        R15                                                     \n" \\r
-\r
-               /* Shifted left as it is restored to the low order word. */\r
-               "SHLL           #16, R15                                        \n" \\r
+               "MVFACHI        #0, A1, R15                                     \n" \\r
+               "PUSH.L         R15                                                     \n" \\r
+               /* Low order word. */\r
+               "MVFACLO        #0, A1, R15                                     \n" \\r
+               "PUSH.L         R15                                                     \n" \\r
+               "MVFACGU        #0, A0, R15                                     \n" \\r
+               "PUSH.L         R15                                                     \n" \\r
+               "MVFACHI        #0, A0, R15                                     \n" \\r
+               "PUSH.L         R15                                                     \n" \\r
+               /* Low order word. */\r
+               "MVFACLO        #0, A0, R15                                     \n" \\r
                "PUSH.L         R15                                                     \n" \\r
 \r
                /* Save the stack pointer to the TCB. */\r
@@ -333,10 +359,30 @@ void vSoftwareInterruptISR( void )
 \r
                /* Restore the context of the new task.  The PSW (Program Status Word) and\r
                PC will be popped by the RTE instruction. */\r
-               "POP            R15                                                     \n" \\r
-               "MVTACLO        R15                                                     \n" \\r
-               "POP            R15                                                     \n" \\r
-               "MVTACHI        R15                                                     \n" \\r
+           "POP                R15                                                     \n" \\r
+\r
+           /* Accumulator low 32 bits. */\r
+           "MVTACLO    R15, A0                                         \n" \\r
+           "POP                R15                                                     \n" \\r
+\r
+           /* Accumulator high 32 bits. */\r
+           "MVTACHI    R15, A0                                         \n" \\r
+           "POP                R15                                                     \n" \\r
+\r
+           /* Accumulator guard. */\r
+           "MVTACGU    R15, A0                                         \n" \\r
+           "POP                R15                                                     \n" \\r
+\r
+           /* Accumulator low 32 bits. */\r
+           "MVTACLO    R15, A1                                         \n" \\r
+           "POP                R15                                                     \n" \\r
+\r
+           /* Accumulator high 32 bits. */\r
+           "MVTACHI    R15, A1                                         \n" \\r
+           "POP                R15                                                     \n" \\r
+\r
+           /* Accumulator guard. */\r
+           "MVTACGU    R15, A1                                         \n" \\r
                "POP            R15                                                     \n" \\r
                "MVTC           R15, FPSW                                       \n" \\r
                "POPM           R1-R15                                          \n" \\r
@@ -355,14 +401,14 @@ void vTickISR( void )
 \r
        /* Increment the tick, and perform any processing the new tick value\r
        necessitates.  Ensure IPL is at the max syscall value first. */\r
-       portDISABLE_INTERRUPTS_FROM_KERNEL_ISR();\r
+       portMASK_INTERRUPTS_FROM_KERNEL_ISR();\r
        {\r
                if( xTaskIncrementTick() != pdFALSE )\r
                {\r
                        taskYIELD();\r
                }\r
        }\r
-       portENABLE_INTERRUPTS_FROM_KERNEL_ISR();\r
+       portUNMASK_INTERRUPTS_FROM_KERNEL_ISR();\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
index 8419e7446fce299e6f6d3f20a2b941cad3bcd3e8..82234c397f237aa79801ba62f3ac026d1a46b8f8 100644 (file)
 /* Library includes. */\r
 #include "string.h"\r
 \r
-/* Hardware specifics. */\r
-#include "r_cg_iodefine.h"\r
-\r
 /*-----------------------------------------------------------*/\r
-#define USE_FULL_REGISTER_INITIALISATION\r
 \r
 /* Tasks should start with interrupts enabled and in Supervisor mode, therefore\r
 PSW is set with U and I set, and PM and IPL clear. */\r
@@ -324,7 +320,7 @@ static void prvYieldHandler( void )
        /* Save the rest of the general registers (R15 has been saved already). */\r
        PUSHM   R1-R14\r
 \r
-       /* Save the FPSW and accumulator. */\r
+       /* Save the FPSW and accumulators. */\r
        MVFC    FPSW, R15\r
        PUSH.L  R15\r
        MVFACGU #0, A1, R15\r