summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2008-07-16 09:12:54 +0000
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2008-07-16 09:12:54 +0000
commit7d1ca252b639ae09bf53e8c5e6fd66bb30fe899c (patch)
tree87f2612051a0db209cacb88ee55a93c9bc70fdd6 /Source
parentd6d485b7f39286ef989fa4af63eac6fa2e8f4b44 (diff)
downloadfreertos-7d1ca252b639ae09bf53e8c5e6fd66bb30fe899c.tar.gz
freertos-7d1ca252b639ae09bf53e8c5e6fd66bb30fe899c.tar.bz2
freertos-7d1ca252b639ae09bf53e8c5e6fd66bb30fe899c.tar.xz
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://freertos.svn.sourceforge.net/svnroot/freertos/trunk@406 1d2547de-c912-0410-9cb9-b8ca96c0e9e2
Diffstat (limited to 'Source')
-rw-r--r--Source/portable/MPLAB/PIC24_dsPIC/port.c74
1 files changed, 2 insertions, 72 deletions
diff --git a/Source/portable/MPLAB/PIC24_dsPIC/port.c b/Source/portable/MPLAB/PIC24_dsPIC/port.c
index 1aa4d5d7..e31cc9af 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 */
/*
@@ -309,19 +252,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.
*/
static void prvSetupTimerInterrupt( void )
@@ -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