From d81673363d13a35a70b8147008c29ebf552a16b9 Mon Sep 17 00:00:00 2001 From: richardbarry Date: Wed, 16 Jul 2008 09:12:54 +0000 Subject: [PATCH] Removed the manual context switch from the C file, this is now in an asm file instead. This is a workaround for a compiler bug but provides a better implementation anyway as less stack is used. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@406 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- Source/portable/MPLAB/PIC24_dsPIC/port.c | 74 +----------------------- 1 file changed, 2 insertions(+), 72 deletions(-) diff --git a/Source/portable/MPLAB/PIC24_dsPIC/port.c b/Source/portable/MPLAB/PIC24_dsPIC/port.c index 1aa4d5d7d..e31cc9af4 100644 --- a/Source/portable/MPLAB/PIC24_dsPIC/port.c +++ b/Source/portable/MPLAB/PIC24_dsPIC/port.c @@ -103,29 +103,6 @@ unsigned portBASE_TYPE uxCriticalNesting = 0xef; "POP.D W0 \n" \ "POP SR " ); - - #define portSAVE_CONTEXT() \ - asm volatile( "PUSH SR \n" /* Save the SR used by the task.... */ \ - "PUSH W0 \n" /* ....then disable interrupts. */ \ - "MOV #32, W0 \n" \ - "MOV W0, SR \n" \ - "PUSH W1 \n" /* Save registers to the stack. */ \ - "PUSH.D W2 \n" \ - "PUSH.D W4 \n" \ - "PUSH.D W6 \n" \ - "PUSH.D W8 \n" \ - "PUSH.D W10 \n" \ - "PUSH.D W12 \n" \ - "PUSH W14 \n" \ - "PUSH RCOUNT \n" \ - "PUSH TBLPAG \n" \ - "PUSH CORCON \n" \ - "PUSH PSVPAG \n" \ - "MOV _uxCriticalNesting, W0 \n" /* Save the critical nesting counter for the task. */ \ - "PUSH W0 \n" \ - "MOV _pxCurrentTCB, W0 \n" /* Save the new top of stack into the TCB. */ \ - "MOV W15, [W0] "); - #endif /* MPLAB_PIC24_PORT */ #ifdef MPLAB_DSPIC_PORT @@ -160,40 +137,6 @@ unsigned portBASE_TYPE uxCriticalNesting = 0xef; "POP.D W0 \n" \ "POP SR " ); - - #define portSAVE_CONTEXT() \ - asm volatile( "PUSH SR \n" /* Save the SR used by the task.... */ \ - "PUSH W0 \n" /* ....then disable interrupts. */ \ - "MOV #32, W0 \n" \ - "MOV W0, SR \n" \ - "PUSH W1 \n" /* Save registers to the stack. */ \ - "PUSH.D W2 \n" \ - "PUSH.D W4 \n" \ - "PUSH.D W6 \n" \ - "PUSH.D W8 \n" \ - "PUSH.D W10 \n" \ - "PUSH.D W12 \n" \ - "PUSH W14 \n" \ - "PUSH RCOUNT \n" \ - "PUSH TBLPAG \n" \ - "PUSH ACCAL \n" \ - "PUSH ACCAH \n" \ - "PUSH ACCAU \n" \ - "PUSH ACCBL \n" \ - "PUSH ACCBH \n" \ - "PUSH ACCBU \n" \ - "PUSH DCOUNT \n" \ - "PUSH DOSTARTL \n" \ - "PUSH DOSTARTH \n" \ - "PUSH DOENDL \n" \ - "PUSH DOENDH \n" \ - "PUSH CORCON \n" \ - "PUSH PSVPAG \n" \ - "MOV _uxCriticalNesting, W0 \n" /* Save the critical nesting counter for the task. */ \ - "PUSH W0 \n" \ - "MOV _pxCurrentTCB, W0 \n" /* Save the new top of stack into the TCB. */ \ - "MOV W15, [W0] " ); - #endif /* MPLAB_DSPIC_PORT */ /* @@ -308,19 +251,6 @@ void vPortEndScheduler( void ) } /*-----------------------------------------------------------*/ -/* - * Manual context switch. This is similar to the tick context switch, - * but does not increment the tick count. It must be identical to the - * tick context switch in how it stores the stack of a task. - */ -void vPortYield( void ) -{ - portSAVE_CONTEXT(); - vTaskSwitchContext(); - portRESTORE_CONTEXT(); -} -/*-----------------------------------------------------------*/ - /* * Setup a timer for a regular tick. */ @@ -371,11 +301,11 @@ void vPortExitCritical( void ) void __attribute__((__interrupt__, auto_psv)) _T1Interrupt( void ) { - vTaskIncrementTick(); - /* Clear the timer interrupt. */ IFS0bits.T1IF = 0; + vTaskIncrementTick(); + #if configUSE_PREEMPTION == 1 portYIELD(); #endif -- 2.39.2