]> git.sur5r.net Git - freertos/commitdiff
Still a work in progress. Need to add flop support.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Fri, 15 Jan 2010 17:18:47 +0000 (17:18 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Fri, 15 Jan 2010 17:18:47 +0000 (17:18 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@956 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Source/portable/Renesas/SH2A_FPU/port.c
Source/portable/Renesas/SH2A_FPU/portasm.src
Source/portable/Renesas/SH2A_FPU/portmacro.h

index a74097fc5b31b125b3152cd66311e908556a0748..b6832f9c290860a4e60ca2152477c8f388fbb7f1 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V6.0.1 - Copyright (C) 2009 Real Time Engineers Ltd.\r
+    FreeRTOS V6.0.2 - Copyright (C) 2009 Real Time Engineers Ltd.\r
 \r
     ***************************************************************************\r
     *                                                                         *\r
@@ -102,61 +102,85 @@ pxTopOfStack--;
        *pxTopOfStack = portINITIAL_SR; \r
        pxTopOfStack--;\r
        \r
-       /* PC then MACL, MACH. */\r
-//     *pxTopOfStack = ( unsigned long ) pxCode;\r
-//     pxTopOfStack -= 3;\r
-*pxTopOfStack = ( unsigned long ) pxCode;\r
-pxTopOfStack--;\r
-*pxTopOfStack = 0xffffUL;\r
-pxTopOfStack--;\r
-*pxTopOfStack = 0xeeeeUL;\r
-pxTopOfStack--;\r
+       /* PC. */\r
+       *pxTopOfStack = ( unsigned long ) pxCode;\r
+       pxTopOfStack--;\r
        \r
-       /* GBR then PR, R14-R5. */\r
-//     *pxTopOfStack = ulPortGetGBR();\r
-//     pxTopOfStack -= 12;\r
-*pxTopOfStack = 0x00UL;\r
-pxTopOfStack--;\r
-*pxTopOfStack = 0x11UL;\r
-pxTopOfStack--;\r
-*pxTopOfStack = 0x22UL;\r
-pxTopOfStack--;\r
-*pxTopOfStack = 0x33UL;\r
-pxTopOfStack--;\r
-*pxTopOfStack = 0x44UL;\r
-pxTopOfStack--;\r
-*pxTopOfStack = 0x55UL;\r
-pxTopOfStack--;\r
-*pxTopOfStack = 0x66UL;\r
-pxTopOfStack--;\r
-*pxTopOfStack = 0x77UL;\r
-pxTopOfStack--;\r
-*pxTopOfStack = 0x88UL;\r
-pxTopOfStack--;\r
-*pxTopOfStack = 0x99UL;\r
-pxTopOfStack--;\r
-*pxTopOfStack = 0xaaUL;\r
-pxTopOfStack--;\r
-*pxTopOfStack = 0xbbUL;\r
-pxTopOfStack--;\r
+       /* PR. */\r
+       *pxTopOfStack = 15;\r
+       pxTopOfStack--;\r
+       \r
+       /* 14. */\r
+       *pxTopOfStack = 14;\r
+       pxTopOfStack--;\r
 \r
-               \r
-       /* Parameters in R4 then R3-R0. */\r
-//     *pxTopOfStack = ( unsigned long ) pvParameters;\r
-//     pxTopOfStack -= 5;\r
+       /* R13. */\r
+       *pxTopOfStack = 13;\r
+       pxTopOfStack--;\r
 \r
-*pxTopOfStack = 0x1UL;\r
-pxTopOfStack--;\r
-*pxTopOfStack = 0x2UL;\r
-pxTopOfStack--;\r
-*pxTopOfStack = 0x3UL;\r
-pxTopOfStack--;\r
-*pxTopOfStack = 0x4UL;\r
-pxTopOfStack--;\r
-*pxTopOfStack = 0x5UL;\r
-//pxTopOfStack--;\r
+       /* R12. */\r
+       *pxTopOfStack = 12;\r
+       pxTopOfStack--;\r
+\r
+       /* R11. */\r
+       *pxTopOfStack = 11;\r
+       pxTopOfStack--;\r
+\r
+       /* R10. */\r
+       *pxTopOfStack = 10;\r
+       pxTopOfStack--;\r
+\r
+       /* R9. */\r
+       *pxTopOfStack = 9;\r
+       pxTopOfStack--;\r
+\r
+       /* R8. */\r
+       *pxTopOfStack = 8;\r
+       pxTopOfStack--;\r
+\r
+       /* R7. */\r
+       *pxTopOfStack = 7;\r
+       pxTopOfStack--;\r
+\r
+       /* R6. */\r
+       *pxTopOfStack = 6;\r
+       pxTopOfStack--;\r
+\r
+       /* R5. */\r
+       *pxTopOfStack = 5;\r
+       pxTopOfStack--;\r
+\r
+       /* R4. */\r
+       *pxTopOfStack = ( unsigned long ) pvParameters;\r
+       pxTopOfStack--;\r
+\r
+       /* R3. */\r
+       *pxTopOfStack = 3;\r
+       pxTopOfStack--;\r
 \r
+       /* R2. */\r
+       *pxTopOfStack = 2;\r
+       pxTopOfStack--;\r
 \r
+       /* R1. */\r
+       *pxTopOfStack = 1;\r
+       pxTopOfStack--;\r
+       \r
+       /* R0 */\r
+       *pxTopOfStack = 0;\r
+       pxTopOfStack--;\r
+       \r
+       /* MACL. */\r
+       *pxTopOfStack = 16;\r
+       pxTopOfStack--;\r
+       \r
+       /* MACH. */\r
+       *pxTopOfStack = 17;\r
+       pxTopOfStack--;\r
+       \r
+       /* GBR. */\r
+       *pxTopOfStack = ulPortGetGBR();\r
+       \r
        /* GBR = global base register.\r
           VBR = vector base register.\r
           TBR = jump table base register.\r
@@ -169,7 +193,7 @@ pxTopOfStack--;
 portBASE_TYPE xPortStartScheduler( void )\r
 {\r
        /* Start the tick interrupt. */\r
-//     prvSetupTimerInterrupt();\r
+       prvSetupTimerInterrupt();\r
        \r
        /* Start the first task. */\r
        trapa( 32 );\r
@@ -207,3 +231,6 @@ extern void vApplicationSetupTimerInterrupt( void );
 \r
 \r
 \r
+\r
+\r
+\r
index 30f80e6cb885474ad48ac2bdfb1d1843fe0fa587..5ab645a9b67520c10892d0ddd8757a8bc8b74f1e 100644 (file)
@@ -1,5 +1,5 @@
 ;/*\r
-;    FreeRTOS V6.0.1 - Copyright (C) 2009 Real Time Engineers Ltd.\r
+;    FreeRTOS V6.0.2 - Copyright (C) 2009 Real Time Engineers Ltd.\r
 ;\r
 ;    ***************************************************************************\r
 ;    *                                                                         *\r
 \r
        .import _pxCurrentTCB\r
        .import _vTaskSwitchContext\r
+       .import _vTaskIncrementTick\r
 \r
        .export _vPortStartFirstTask\r
        .export _ulPortGetGBR\r
        .export _vPortYield\r
+       .export _vPortPreemptiveTick\r
+       .export _vPortCooperativeTick\r
 \r
     .section    P\r
-       \r
-_vPortStartFirstTask:\r
-               \r
-       ; Get the address of the pxCurrentTCB variable.\r
-       mov.l   #_pxCurrentTCB, r15\r
 \r
-       ; Get the address of the task stack from pxCurrentTCB.\r
-       mov.l   @r15, r15\r
-\r
-       ; Get the task stack itself into the stack pointer. \r
-       mov.l   @r15, r15               \r
+       .macro portSAVE_CONTEXT\r
 \r
-       ; Restore r0 to PR (PR is used in place of r15).\r
-       movml.l @r15+, r15\r
+       ; Save r0 to r14 and pr.\r
+       movml.l r15, @-r15\r
        \r
-       ; Restore system registers.\r
-       ldc.l   @r15+, gbr\r
-       lds.l   @r15+, mach\r
-       lds.l   @r15+, macl\r
-       \r
-       ; Pop the SR and PC to jump to the start of the task.\r
-       rte\r
-       nop\r
-\r
-_vPortYield:\r
-\r
-       ; Save registers in the same order used by the CPU itself.\r
+       ; Save mac1, mach and gbr\r
        sts.l   macl, @-r15\r
        sts.l   mach, @-r15\r
        stc.l   gbr, @-r15\r
-       movml.l r15, @-r15\r
        \r
        ; Get the address of pxCurrentTCB\r
        mov.l   #_pxCurrentTCB, r0\r
@@ -100,31 +82,93 @@ _vPortYield:
        ; Save the stack pointer in pxTopOfStack.\r
        mov.l   r15, @r0\r
 \r
-       mov.l   #_vTaskSwitchContext, r0\r
-       jsr             @r0\r
-       nop\r
+       .endm\r
+\r
+;-----------------------------------------------------------\r
+\r
+       .macro portRESTORE_CONTEXT\r
 \r
        ; Get the address of the pxCurrentTCB variable.\r
-       mov.l   #_pxCurrentTCB, r15\r
+       mov.l   #_pxCurrentTCB, r0\r
 \r
        ; Get the address of the task stack from pxCurrentTCB.\r
-       mov.l   @r15, r15\r
+       mov.l   @r0, r0\r
 \r
        ; Get the task stack itself into the stack pointer. \r
-       mov.l   @r15, r15               \r
+       mov.l   @r0, r15                \r
 \r
-       ; Restore r0 to PR (PR is used in place of r15).\r
-       movml.l @r15+, r15\r
-       \r
        ; Restore system registers.\r
        ldc.l   @r15+, gbr\r
        lds.l   @r15+, mach\r
        lds.l   @r15+, macl\r
+\r
+       ; Restore r0 to r14 and PR\r
+       movml.l @r15+, r15\r
        \r
        ; Pop the SR and PC to jump to the start of the task.\r
        rte\r
        nop\r
 \r
+       .endm\r
+;-----------------------------------------------------------\r
+       \r
+_vPortStartFirstTask:\r
+               \r
+       portRESTORE_CONTEXT\r
+       \r
+;-----------------------------------------------------------\r
+\r
+_vPortYield:\r
+\r
+       ; Push r0 so it can be used.\r
+       mov.l   r0, @-r15\r
+       \r
+       ; Set the interrupt mask in the status register.\r
+       stc             sr, r0\r
+       or              #240,r0\r
+       ldc             r0, sr\r
+       \r
+       ; Restore r0 so its original value can be saved by the movml.l instruction \r
+       ; below, without ending up with two copies on the stack.\r
+       mov.l   @r15+, r0\r
+\r
+       portSAVE_CONTEXT\r
+\r
+       mov.l   #_vTaskSwitchContext, r0\r
+       jsr             @r0\r
+       nop\r
+\r
+       portRESTORE_CONTEXT\r
+       \r
+;-----------------------------------------------------------\r
+\r
+_vPortPreemptiveTick\r
+\r
+       portSAVE_CONTEXT\r
+       \r
+       mov.l   #_vTaskIncrementTick, r0\r
+       jsr             @r0\r
+       nop\r
+\r
+       mov.l   #_vTaskSwitchContext, r0\r
+       jsr             @r0\r
+       nop\r
+\r
+       portRESTORE_CONTEXT\r
+       \r
+;-----------------------------------------------------------\r
+\r
+_vPortCooperativeTick\r
+\r
+       portSAVE_CONTEXT\r
+       \r
+       mov.l   #_vTaskIncrementTick, r0\r
+       jsr             @r0\r
+       nop\r
+\r
+       portRESTORE_CONTEXT\r
+       \r
+;-----------------------------------------------------------\r
 \r
 _ulPortGetGBR:\r
 \r
index bdc5fa416522e32bc5ea6019b614ad106de36e44..b1c88de7d4be336afe5d6696ce6c29839541722c 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V6.0.1 - Copyright (C) 2009 Real Time Engineers Ltd.\r
+    FreeRTOS V6.0.2 - Copyright (C) 2009 Real Time Engineers Ltd.\r
 \r
     ***************************************************************************\r
     *                                                                         *\r
@@ -98,14 +98,15 @@ extern "C" {
 /*-----------------------------------------------------------*/\r
 \r
 #define portENABLE_INTERRUPTS()        set_imask( 0x00 )\r
-#define portDISABLE_INTERRUPTS()       set_imask( 0x0F )\r
+#define portDISABLE_INTERRUPTS()       set_imask( configMAX_SYSCALL_INTERRUPT_PRIORITY )\r
 \r
 /* Critical section handling. */\r
 #define portCRITICAL_NESTING_IN_TCB ( 1 )\r
 extern void vTaskEnterCritical( void );\r
 extern void vTaskExitCritical( void );\r
-#define portENTER_CRITICAL()           vTaskEnterCritical();\r
-#define  portEXIT_CRITICAL()           vTaskExitCritical();\r
+#define portENTER_CRITICAL()   vTaskEnterCritical();\r
+#define portEXIT_CRITICAL()            vTaskExitCritical();\r
+\r
 /*-----------------------------------------------------------*/\r
 \r
 /* Task function macros as described on the FreeRTOS.org WEB site. */\r