From: richardbarry Date: Mon, 15 Feb 2010 17:16:38 +0000 (+0000) Subject: Continue work on the SH2A port. X-Git-Tag: V6.0.3~4 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=409062d07bf235c4a260b072f2bd8132dbb24f8a;p=freertos Continue work on the SH2A port. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@982 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/Source/portable/Renesas/SH2A_FPU/ISR_Support.inc b/Source/portable/Renesas/SH2A_FPU/ISR_Support.inc new file mode 100644 index 000000000..0ee6f359e --- /dev/null +++ b/Source/portable/Renesas/SH2A_FPU/ISR_Support.inc @@ -0,0 +1,48 @@ + .macro portSAVE_CONTEXT + + ; Save r0 to r14 and pr. + movml.l r15, @-r15 + + ; Save mac1, mach and gbr + sts.l macl, @-r15 + sts.l mach, @-r15 + stc.l gbr, @-r15 + + ; Get the address of pxCurrentTCB + mov.l #_pxCurrentTCB, r0 + + ; Get the address of pxTopOfStack from the TCB. + mov.l @r0, r0 + + ; Save the stack pointer in pxTopOfStack. + mov.l r15, @r0 + + .endm + +;----------------------------------------------------------- + + .macro portRESTORE_CONTEXT + + ; Get the address of the pxCurrentTCB variable. + mov.l #_pxCurrentTCB, r0 + + ; Get the address of the task stack from pxCurrentTCB. + mov.l @r0, r0 + + ; Get the task stack itself into the stack pointer. + mov.l @r0, r15 + + ; Restore system registers. + ldc.l @r15+, gbr + lds.l @r15+, mach + lds.l @r15+, macl + + ; Restore r0 to r14 and PR + movml.l @r15+, r15 + + ; Pop the SR and PC to jump to the start of the task. + rte + nop + + .endm +;----------------------------------------------------------- \ No newline at end of file diff --git a/Source/portable/Renesas/SH2A_FPU/port.c b/Source/portable/Renesas/SH2A_FPU/port.c index 7ce291939..536281362 100644 --- a/Source/portable/Renesas/SH2A_FPU/port.c +++ b/Source/portable/Renesas/SH2A_FPU/port.c @@ -241,7 +241,7 @@ long lInterruptMask; trapa( portYIELD_TRAP_NO ); /* Restore the interrupt mask to whatever it was previously (when the - function was entered. */ + function was entered). */ set_imask( ( int ) lInterruptMask ); } /*-----------------------------------------------------------*/ @@ -290,8 +290,3 @@ extern void * volatile pxCurrentTCB; /*-----------------------------------------------------------*/ - - - - - diff --git a/Source/portable/Renesas/SH2A_FPU/portasm.src b/Source/portable/Renesas/SH2A_FPU/portasm.src index 948b57dd7..591b2f5bb 100644 --- a/Source/portable/Renesas/SH2A_FPU/portasm.src +++ b/Source/portable/Renesas/SH2A_FPU/portasm.src @@ -65,54 +65,7 @@ .section P - .macro portSAVE_CONTEXT - - ; Save r0 to r14 and pr. - movml.l r15, @-r15 - - ; Save mac1, mach and gbr - sts.l macl, @-r15 - sts.l mach, @-r15 - stc.l gbr, @-r15 - - ; Get the address of pxCurrentTCB - mov.l #_pxCurrentTCB, r0 - - ; Get the address of pxTopOfStack from the TCB. - mov.l @r0, r0 - - ; Save the stack pointer in pxTopOfStack. - mov.l r15, @r0 - - .endm - -;----------------------------------------------------------- - - .macro portRESTORE_CONTEXT - - ; Get the address of the pxCurrentTCB variable. - mov.l #_pxCurrentTCB, r0 - - ; Get the address of the task stack from pxCurrentTCB. - mov.l @r0, r0 - - ; Get the task stack itself into the stack pointer. - mov.l @r0, r15 - - ; Restore system registers. - ldc.l @r15+, gbr - lds.l @r15+, mach - lds.l @r15+, macl - - ; Restore r0 to r14 and PR - movml.l @r15+, r15 - - ; Pop the SR and PC to jump to the start of the task. - rte - nop - - .endm -;----------------------------------------------------------- + .INCLUDE "ISR_Support.inc" _vPortStartFirstTask: diff --git a/Source/portable/Renesas/SH2A_FPU/portmacro.h b/Source/portable/Renesas/SH2A_FPU/portmacro.h index 93c64d96b..c174914e0 100644 --- a/Source/portable/Renesas/SH2A_FPU/portmacro.h +++ b/Source/portable/Renesas/SH2A_FPU/portmacro.h @@ -102,6 +102,9 @@ portSTACK_TYPE and portBASE_TYPE. */ void vPortYield( void ); #define portYIELD() vPortYield() +extern void vTaskSwitchContext( void ); +#define portYIELD_FROM_ISR( x ) if( x != pdFALSE ) vTaskSwitchContext() + /* * This function tells the kernel that the task referenced by xTask is going to * use the floating point registers and therefore requires the floating point