From e2d8c64ec3fddfb737b42b43ad986b5af76bcecc Mon Sep 17 00:00:00 2001 From: richardbarry Date: Mon, 22 Oct 2012 16:40:45 +0000 Subject: [PATCH] Re-jig some of the new functions to correctly assign them public or private linkage, and remove some functions that were added in but never used. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1799 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- FreeRTOS/Source/include/FreeRTOS.h | 8 +-- FreeRTOS/Source/include/task.h | 13 ----- .../portable/CCS/ARM_Cortex-R4/portASM.asm | 2 +- FreeRTOS/Source/portable/GCC/ARM_CM3/port.c | 4 +- .../Source/portable/GCC/ARM_CM3/portmacro.h | 6 ++- FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c | 4 +- .../Source/portable/GCC/ARM_CM4F/portmacro.h | 6 ++- FreeRTOS/Source/portable/IAR/ARM_CM3/port.c | 4 +- .../Source/portable/IAR/ARM_CM3/portmacro.h | 8 +-- FreeRTOS/Source/portable/IAR/ARM_CM4F/port.c | 4 +- .../Source/portable/IAR/ARM_CM4F/portmacro.h | 8 +-- FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c | 4 +- .../Source/portable/RVDS/ARM_CM3/portmacro.h | 8 +-- FreeRTOS/Source/portable/RVDS/ARM_CM4F/port.c | 4 +- .../Source/portable/RVDS/ARM_CM4F/portmacro.h | 8 +-- FreeRTOS/Source/tasks.c | 50 +++++++++---------- 16 files changed, 68 insertions(+), 73 deletions(-) diff --git a/FreeRTOS/Source/include/FreeRTOS.h b/FreeRTOS/Source/include/FreeRTOS.h index 7be6110f4..c9eda0fd7 100644 --- a/FreeRTOS/Source/include/FreeRTOS.h +++ b/FreeRTOS/Source/include/FreeRTOS.h @@ -534,12 +534,12 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * ); #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) #endif -#ifndef portPRE_SLEEP_PROCESSING - #define portPRE_SLEEP_PROCESSING() +#ifndef configPRE_SLEEP_PROCESSING + #define configPRE_SLEEP_PROCESSING() #endif -#ifndef portPOST_SLEEP_PROCESSING - #define portPOST_SLEEP_PROCESSING() +#ifndef configPOST_SLEEP_PROCESSING + #define configPOST_SLEEP_PROCESSING() #endif #endif /* INC_FREERTOS_H */ diff --git a/FreeRTOS/Source/include/task.h b/FreeRTOS/Source/include/task.h index 1afc16cea..b6a7818a8 100644 --- a/FreeRTOS/Source/include/task.h +++ b/FreeRTOS/Source/include/task.h @@ -1320,12 +1320,6 @@ unsigned portBASE_TYPE uxTaskGetTaskNumber( xTaskHandle xTask ); */ void vTaskSetTaskNumber( xTaskHandle xTask, unsigned portBASE_TYPE uxHandle ); -/* - * Return the amount of time, in ticks, that will pass before the kernel will - * next move a task from the Blocked state to the Running state. - */ -portTickType xTaskGetExpectedIdleTime( void ); - /* * If tickless mode is being used, or a low power mode is implemented, then * the tick interrupt will not execute during idle periods. When this is the @@ -1335,13 +1329,6 @@ portTickType xTaskGetExpectedIdleTime( void ); */ void vTaskStepTick( portTickType xTicksToJump ); -/* - * Returns the number of tick interrupts that have occurred while the scheduler - * has been suspended. The count pending ticks is reset if xResetOnExit is set - * to pdTRUE. - */ -unsigned portBASE_TYPE uxTaskPendingTicksGet( portBASE_TYPE xResetOnExit ); - #ifdef __cplusplus } #endif diff --git a/FreeRTOS/Source/portable/CCS/ARM_Cortex-R4/portASM.asm b/FreeRTOS/Source/portable/CCS/ARM_Cortex-R4/portASM.asm index b3d4a6c78..989e5dbb3 100644 --- a/FreeRTOS/Source/portable/CCS/ARM_Cortex-R4/portASM.asm +++ b/FreeRTOS/Source/portable/CCS/ARM_Cortex-R4/portASM.asm @@ -146,7 +146,7 @@ portRESTORE_CONTEXT .macro ; Get the SPSR from the stack. LDMFD LR!, {R0} - MSR SPSR_CF, R0 + MSR SPSR_CSXF, R0 ; Restore all system mode registers for the task. LDMFD LR, {R0-R14}^ diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c b/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c index 0a88a9c72..440109489 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c +++ b/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c @@ -403,9 +403,9 @@ void xPortSysTickHandler( void ) portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT; /* Sleep until something happens. */ - portPRE_SLEEP_PROCESSING(); + configPRE_SLEEP_PROCESSING(); __asm volatile( "wfi" ); - portPOST_SLEEP_PROCESSING(); + configPOST_SLEEP_PROCESSING(); /* Stop SysTick. Again, the time the SysTick is stopped for is accounted for as best it can be, but using the tickless mode will diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h b/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h index d9c3b42c5..e6f0989f7 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h @@ -136,8 +136,10 @@ not necessary for to use this port. They are defined so the common demo files /*-----------------------------------------------------------*/ /* Tickless idle/low power functionality. */ -extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ); -#define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) +#ifndef portSUPPRESS_TICKS_AND_SLEEP + extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ); + #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) +#endif /*-----------------------------------------------------------*/ /* Architecture specific optimisations. */ diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c b/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c index 51781e7bf..41da9a79e 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c +++ b/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c @@ -438,9 +438,9 @@ void xPortSysTickHandler( void ) portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT; /* Sleep until something happens. */ - portPRE_SLEEP_PROCESSING(); + configPRE_SLEEP_PROCESSING(); __asm volatile( "wfi" ); - portPOST_SLEEP_PROCESSING(); + configPOST_SLEEP_PROCESSING(); /* Stop SysTick. Again, the time the SysTick is stopped for is accounted for as best it can be, but using the tickless mode will diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h b/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h index b35ae8517..d74c9bb2c 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h @@ -143,8 +143,10 @@ not necessary for to use this port. They are defined so the common demo files /*-----------------------------------------------------------*/ /* Tickless idle/low power functionality. */ -extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ); -#define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) +#ifndef portSUPPRESS_TICKS_AND_SLEEP + extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ); + #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) +#endif /*-----------------------------------------------------------*/ /* Architecture specific optimisations. */ diff --git a/FreeRTOS/Source/portable/IAR/ARM_CM3/port.c b/FreeRTOS/Source/portable/IAR/ARM_CM3/port.c index bfdbeb3f7..2601d5035 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CM3/port.c +++ b/FreeRTOS/Source/portable/IAR/ARM_CM3/port.c @@ -300,9 +300,9 @@ void xPortSysTickHandler( void ) portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT; /* Sleep until something happens. */ - portPRE_SLEEP_PROCESSING(); + configPRE_SLEEP_PROCESSING(); __WFI(); - portPOST_SLEEP_PROCESSING(); + configPOST_SLEEP_PROCESSING(); /* Stop SysTick. Again, the time the SysTick is stopped for is accounted for as best it can be, but using the tickless mode will diff --git a/FreeRTOS/Source/portable/IAR/ARM_CM3/portmacro.h b/FreeRTOS/Source/portable/IAR/ARM_CM3/portmacro.h index ce9e9639e..8116bac8d 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CM3/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/ARM_CM3/portmacro.h @@ -148,9 +148,11 @@ extern void vPortClearInterruptMask( unsigned long ulNewMask ); #define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vPortClearInterruptMask( x ) /*-----------------------------------------------------------*/ -/* Tickless/low power functionality. */ -extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ); -#define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) +/* Tickless idle/low power functionality. */ +#ifndef portSUPPRESS_TICKS_AND_SLEEP + extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ); + #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) +#endif /*-----------------------------------------------------------*/ /* Task function macros as described on the FreeRTOS.org WEB site. These are diff --git a/FreeRTOS/Source/portable/IAR/ARM_CM4F/port.c b/FreeRTOS/Source/portable/IAR/ARM_CM4F/port.c index 61c08cb68..3ee8eb349 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CM4F/port.c +++ b/FreeRTOS/Source/portable/IAR/ARM_CM4F/port.c @@ -325,9 +325,9 @@ void xPortSysTickHandler( void ) portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT; /* Sleep until something happens. */ - portPRE_SLEEP_PROCESSING(); + configPRE_SLEEP_PROCESSING(); __WFI(); - portPOST_SLEEP_PROCESSING(); + configPOST_SLEEP_PROCESSING(); /* Stop SysTick. Again, the time the SysTick is stopped for is accounted for as best it can be, but using the tickless mode will diff --git a/FreeRTOS/Source/portable/IAR/ARM_CM4F/portmacro.h b/FreeRTOS/Source/portable/IAR/ARM_CM4F/portmacro.h index 935de5d7d..676660690 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CM4F/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/ARM_CM4F/portmacro.h @@ -153,9 +153,11 @@ portALIGNMENT_ASSERT_pxCurrentTCB() will trigger false positive asserts. */ #define portALIGNMENT_ASSERT_pxCurrentTCB ( void ) /*-----------------------------------------------------------*/ -/* Tickless/low power functionality. */ -extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ); -#define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) +/* Tickless idle/low power functionality. */ +#ifndef portSUPPRESS_TICKS_AND_SLEEP + extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ); + #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) +#endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c b/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c index 2bdcd8f9d..5c3a5534e 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c +++ b/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c @@ -368,9 +368,9 @@ void xPortSysTickHandler( void ) portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT; /* Sleep until something happens. */ - portPRE_SLEEP_PROCESSING(); + configPRE_SLEEP_PROCESSING(); __wfi(); - portPOST_SLEEP_PROCESSING(); + configPOST_SLEEP_PROCESSING(); /* Stop SysTick. Again, the time the SysTick is stopped for is accounted for as best it can be, but using the tickless mode will diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CM3/portmacro.h b/FreeRTOS/Source/portable/RVDS/ARM_CM3/portmacro.h index 08bbe69a0..c64420c7f 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM_CM3/portmacro.h +++ b/FreeRTOS/Source/portable/RVDS/ARM_CM3/portmacro.h @@ -129,9 +129,11 @@ extern void vPortExitCritical( void ); #define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vPortClearInterruptMask(x) /*-----------------------------------------------------------*/ -/* Tickless/low power optimisations. */ -extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ); -#define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) +/* Tickless idle/low power functionality. */ +#ifndef portSUPPRESS_TICKS_AND_SLEEP + extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ); + #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) +#endif /*-----------------------------------------------------------*/ /* Port specific optimisations. */ diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CM4F/port.c b/FreeRTOS/Source/portable/RVDS/ARM_CM4F/port.c index 7ccd107b5..02818c5e2 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM_CM4F/port.c +++ b/FreeRTOS/Source/portable/RVDS/ARM_CM4F/port.c @@ -431,9 +431,9 @@ void xPortSysTickHandler( void ) portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT; /* Sleep until something happens. */ - portPRE_SLEEP_PROCESSING(); + configPRE_SLEEP_PROCESSING(); __wfi(); - portPOST_SLEEP_PROCESSING(); + configPOST_SLEEP_PROCESSING(); /* Stop SysTick. Again, the time the SysTick is stopped for is accounted for as best it can be, but using the tickless mode will diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CM4F/portmacro.h b/FreeRTOS/Source/portable/RVDS/ARM_CM4F/portmacro.h index cc39f85d5..0e8d56d51 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM_CM4F/portmacro.h +++ b/FreeRTOS/Source/portable/RVDS/ARM_CM4F/portmacro.h @@ -135,9 +135,11 @@ portALIGNMENT_ASSERT_pxCurrentTCB() will trigger false positive asserts. */ #define portALIGNMENT_ASSERT_pxCurrentTCB ( void ) /*-----------------------------------------------------------*/ -/* Tickless/low power optimisations. */ -extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ); -#define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) +/* Tickless idle/low power functionality. */ +#ifndef portSUPPRESS_TICKS_AND_SLEEP + extern void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ); + #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime ) vPortSuppressTicksAndSleep( xExpectedIdleTime ) +#endif /*-----------------------------------------------------------*/ /* Port specific optimisations. */ diff --git a/FreeRTOS/Source/tasks.c b/FreeRTOS/Source/tasks.c index ac1ca9c28..ef6208fc9 100644 --- a/FreeRTOS/Source/tasks.c +++ b/FreeRTOS/Source/tasks.c @@ -460,6 +460,15 @@ static tskTCB *prvAllocateTCBAndStack( unsigned short usStackDepth, portSTACK_TY #endif +/* + * Return the amount of time, in ticks, that will pass before the kernel will + * next move a task from the Blocked state to the Running state. + */ +#if ( configUSE_TICKLESS_IDLE == 1 ) + + static portTickType prvGetExpectedIdleTime( void ) PRIVILEGED_FUNCTION; + +#endif /*lint +e956 */ @@ -1305,7 +1314,7 @@ void vTaskSuspendAll( void ) } /*----------------------------------------------------------*/ -portTickType xTaskGetExpectedIdleTime( void ) +portTickType prvGetExpectedIdleTime( void ) { portTickType xReturn; @@ -1618,11 +1627,15 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void ) #endif /*----------------------------------------------------------*/ -void vTaskStepTick( portTickType xTicksToJump ) -{ - configASSERT( xTicksToJump <= xNextTaskUnblockTime ); - xTickCount += xTicksToJump; -} +#if ( configUSE_TICKLESS_IDLE == 1 ) + + void vTaskStepTick( portTickType xTicksToJump ) + { + configASSERT( xTicksToJump <= xNextTaskUnblockTime ); + xTickCount += xTicksToJump; + } + +#endif /*----------------------------------------------------------- * SCHEDULER INTERNALS AVAILABLE FOR PORTING PURPOSES @@ -1917,6 +1930,8 @@ portTickType xTimeToWake; /* Calculate the time at which the task should be woken if the event does not occur. This may overflow but this doesn't matter. */ xTimeToWake = xTickCount + xTicksToWait; + + traceTASK_DELAY_UNTIL(); prvAddCurrentTaskToDelayedList( xTimeToWake ); } @@ -2150,7 +2165,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters ) test of the expected idle time is performed without the scheduler suspended. The result here is not necessarily valid. */ - xExpectedIdleTime = xTaskGetExpectedIdleTime(); + xExpectedIdleTime = prvGetExpectedIdleTime(); if( xExpectedIdleTime >= xMinimumExpectedIdleTime ) { @@ -2160,7 +2175,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters ) time can be sampled again, and this time its value can be used. */ configASSERT( xNextTaskUnblockTime >= xTickCount ); - xExpectedIdleTime = xTaskGetExpectedIdleTime(); + xExpectedIdleTime = prvGetExpectedIdleTime(); if( xExpectedIdleTime >= xMinimumExpectedIdleTime ) { @@ -2723,25 +2738,6 @@ tskTCB *pxNewTCB; #endif /*-----------------------------------------------------------*/ -#if ( configUSE_TICKLESS_IDLE == 1 ) - - unsigned portBASE_TYPE uxTaskPendingTicksGet( portBASE_TYPE xResetOnExit ) - { - unsigned portBASE_TYPE uxReturn; - - uxReturn = uxMissedTicks; - - if( xResetOnExit == pdTRUE ) - { - uxMissedTicks = 0; - } - - return uxReturn; - } - -#endif -/*-----------------------------------------------------------*/ - -- 2.39.5