mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
Modify the GCC/AVR port to make use of the xTaskIncrementTick return value.
Add pre-processor directives in the dsPIC and PIC24 port layers that allows both port files to be included in the same project.
This commit is contained in:
parent
3aad6381e1
commit
2fd431e971
|
@ -56,19 +56,19 @@
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
license and Real Time Engineers Ltd. contact details.
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
fully thread aware and reentrant UDP/IP stack.
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
Integrity Systems, who sell the code with commercial support,
|
Integrity Systems, who sell the code with commercial support,
|
||||||
indemnification and middleware, under the OpenRTOS brand.
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
engineered and independently SIL3 certified version for use in safety and
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
mission critical applications that require provable dependability.
|
mission critical applications that require provable dependability.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -104,6 +104,7 @@ extern "C" {
|
||||||
#define portSHORT int
|
#define portSHORT int
|
||||||
#define portSTACK_TYPE unsigned portCHAR
|
#define portSTACK_TYPE unsigned portCHAR
|
||||||
#define portBASE_TYPE portCHAR
|
#define portBASE_TYPE portCHAR
|
||||||
|
#define portPOINTER_SIZE_TYPE unsigned short
|
||||||
|
|
||||||
#if( configUSE_16_BIT_TICKS == 1 )
|
#if( configUSE_16_BIT_TICKS == 1 )
|
||||||
typedef unsigned portSHORT portTickType;
|
typedef unsigned portSHORT portTickType;
|
||||||
|
@ -113,7 +114,7 @@ extern "C" {
|
||||||
#define portMAX_DELAY ( portTickType ) 0xffffffff
|
#define portMAX_DELAY ( portTickType ) 0xffffffff
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* Critical section management. */
|
/* Critical section management. */
|
||||||
extern void vPortEnterCritical( void );
|
extern void vPortEnterCritical( void );
|
||||||
|
@ -127,7 +128,7 @@ extern void vPortExitCritical( void );
|
||||||
|
|
||||||
/* Architecture specifics. */
|
/* Architecture specifics. */
|
||||||
#define portSTACK_GROWTH ( -1 )
|
#define portSTACK_GROWTH ( -1 )
|
||||||
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||||
#define portBYTE_ALIGNMENT 1
|
#define portBYTE_ALIGNMENT 1
|
||||||
#define portNOP() asm( "nop" )
|
#define portNOP() asm( "nop" )
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
;/*
|
;/*
|
||||||
; FreeRTOS V7.4.2 - Copyright (C) 2013 Real Time Engineers Ltd.
|
; FreeRTOS V7.4.2 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
;
|
;
|
||||||
;
|
;
|
||||||
; ***************************************************************************
|
; ***************************************************************************
|
||||||
; * *
|
; * *
|
||||||
|
@ -103,7 +103,7 @@ PUBLIC vPortStart
|
||||||
ORG USART_UDRE_vect ; Vector address
|
ORG USART_UDRE_vect ; Vector address
|
||||||
jmp SIG_UART_DATA ; ISR
|
jmp SIG_UART_DATA ; ISR
|
||||||
|
|
||||||
|
|
||||||
RSEG CODE
|
RSEG CODE
|
||||||
|
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ portRESTORE_CONTEXT MACRO
|
||||||
out SREG, r0
|
out SREG, r0
|
||||||
|
|
||||||
ld r0, y+ ; Finally we have finished with r0, so restore r0.
|
ld r0, y+ ; Finally we have finished with r0, so restore r0.
|
||||||
|
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
|
||||||
|
@ -244,7 +244,10 @@ vPortYield:
|
||||||
vPortYieldFromTick:
|
vPortYieldFromTick:
|
||||||
portSAVE_CONTEXT ; Save the context of the current task.
|
portSAVE_CONTEXT ; Save the context of the current task.
|
||||||
call xTaskIncrementTick ; Call the timer tick function.
|
call xTaskIncrementTick ; Call the timer tick function.
|
||||||
|
tst r16
|
||||||
|
breq SkipTaskSwitch
|
||||||
call vTaskSwitchContext ; Call the scheduler.
|
call vTaskSwitchContext ; Call the scheduler.
|
||||||
|
SkipTaskSwitch:
|
||||||
portRESTORE_CONTEXT ; Restore the context of whichever task the ...
|
portRESTORE_CONTEXT ; Restore the context of whichever task the ...
|
||||||
ret ; ... scheduler decided should run.
|
ret ; ... scheduler decided should run.
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ unsigned portBASE_TYPE uxCriticalNesting = 0xef;
|
||||||
#endif /* __HAS_EDS__ */
|
#endif /* __HAS_EDS__ */
|
||||||
#endif /* MPLAB_PIC24_PORT */
|
#endif /* MPLAB_PIC24_PORT */
|
||||||
|
|
||||||
#if defined( __dsPIC30F__ ) || defined ( __dsPIC33E__ ) || defined( __dsPIC33F__ )
|
#if defined( __dsPIC30F__ ) || defined( __dsPIC33F__ )
|
||||||
|
|
||||||
#define portRESTORE_CONTEXT() \
|
#define portRESTORE_CONTEXT() \
|
||||||
asm volatile( "MOV _pxCurrentTCB, W0 \n" /* Restore the stack pointer for the task. */ \
|
asm volatile( "MOV _pxCurrentTCB, W0 \n" /* Restore the stack pointer for the task. */ \
|
||||||
|
|
|
@ -72,6 +72,8 @@
|
||||||
mission critical applications that require provable dependability.
|
mission critical applications that require provable dependability.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if defined( __PIC24E__ ) || defined ( __PIC24F__ ) || defined( __PIC24FK__ ) || defined( __PIC24H__ )
|
||||||
|
|
||||||
.global _vPortYield
|
.global _vPortYield
|
||||||
.extern _vTaskSwitchContext
|
.extern _vTaskSwitchContext
|
||||||
.extern uxCriticalNesting
|
.extern uxCriticalNesting
|
||||||
|
@ -133,3 +135,5 @@ _vPortYield:
|
||||||
return
|
return
|
||||||
|
|
||||||
.end
|
.end
|
||||||
|
|
||||||
|
#endif /* defined( __PIC24E__ ) || defined ( __PIC24F__ ) || defined( __PIC24FK__ ) || defined( __PIC24H__ ) */
|
|
@ -56,22 +56,24 @@
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
license and Real Time Engineers Ltd. contact details.
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
fully thread aware and reentrant UDP/IP stack.
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
Integrity Systems, who sell the code with commercial support,
|
Integrity Systems, who sell the code with commercial support,
|
||||||
indemnification and middleware, under the OpenRTOS brand.
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
engineered and independently SIL3 certified version for use in safety and
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
mission critical applications that require provable dependability.
|
mission critical applications that require provable dependability.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if defined( __dsPIC30F__ ) || defined( __dsPIC33F__ )
|
||||||
|
|
||||||
.global _vPortYield
|
.global _vPortYield
|
||||||
.extern _vTaskSwitchContext
|
.extern _vTaskSwitchContext
|
||||||
.extern uxCriticalNesting
|
.extern uxCriticalNesting
|
||||||
|
@ -103,8 +105,8 @@ _vPortYield:
|
||||||
PUSH DOSTARTH
|
PUSH DOSTARTH
|
||||||
PUSH DOENDL
|
PUSH DOENDL
|
||||||
PUSH DOENDH
|
PUSH DOENDH
|
||||||
|
|
||||||
|
|
||||||
PUSH CORCON
|
PUSH CORCON
|
||||||
PUSH PSVPAG
|
PUSH PSVPAG
|
||||||
MOV _uxCriticalNesting, W0 /* Save the critical nesting counter for the task. */
|
MOV _uxCriticalNesting, W0 /* Save the critical nesting counter for the task. */
|
||||||
|
@ -146,3 +148,6 @@ _vPortYield:
|
||||||
return
|
return
|
||||||
|
|
||||||
.end
|
.end
|
||||||
|
|
||||||
|
#endif /* defined( __dsPIC30F__ ) || defined( __dsPIC33F__ ) */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue