mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
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.
This commit is contained in:
parent
d091cf740f
commit
090da3b518
|
@ -103,29 +103,6 @@ unsigned portBASE_TYPE uxCriticalNesting = 0xef;
|
||||||
"POP.D W0 \n" \
|
"POP.D W0 \n" \
|
||||||
"POP SR " );
|
"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 */
|
#endif /* MPLAB_PIC24_PORT */
|
||||||
|
|
||||||
#ifdef MPLAB_DSPIC_PORT
|
#ifdef MPLAB_DSPIC_PORT
|
||||||
|
@ -160,40 +137,6 @@ unsigned portBASE_TYPE uxCriticalNesting = 0xef;
|
||||||
"POP.D W0 \n" \
|
"POP.D W0 \n" \
|
||||||
"POP SR " );
|
"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 */
|
#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.
|
* Setup a timer for a regular tick.
|
||||||
*/
|
*/
|
||||||
|
@ -371,11 +301,11 @@ void vPortExitCritical( void )
|
||||||
|
|
||||||
void __attribute__((__interrupt__, auto_psv)) _T1Interrupt( void )
|
void __attribute__((__interrupt__, auto_psv)) _T1Interrupt( void )
|
||||||
{
|
{
|
||||||
vTaskIncrementTick();
|
|
||||||
|
|
||||||
/* Clear the timer interrupt. */
|
/* Clear the timer interrupt. */
|
||||||
IFS0bits.T1IF = 0;
|
IFS0bits.T1IF = 0;
|
||||||
|
|
||||||
|
vTaskIncrementTick();
|
||||||
|
|
||||||
#if configUSE_PREEMPTION == 1
|
#if configUSE_PREEMPTION == 1
|
||||||
portYIELD();
|
portYIELD();
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue