mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-23 15:01:56 -04:00
Clear up a few compiler warnings.
Correct header comments in the UARTCommandConsole.c file used in the SmartFusion2 demo. Exercise the new xQueueSpacesAvailable() function in the MSVC demo. Add defaults for the new traceMALLOC and traceFREE trace macros. Catch tasks trying to exit their functions in the Cortex-M0 ports. Add additional comments to timers.c in response to a support forum question. Initialise _impure_ptr prior to the first task being started. Prior to V7.5.0 a yield pended in the tick hook would have occurred during the same tick interrupt. Return pdTRUE from xTaskIncrementTick() if a yield is pending to revert to that behaviour.
This commit is contained in:
parent
be44f8aaa7
commit
eaacbb099a
|
@ -1,54 +1,65 @@
|
||||||
/*
|
/*
|
||||||
FreeRTOS V7.1.0 - Copyright (C) 2011 Real Time Engineers Ltd.
|
FreeRTOS V7.5.2 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
* *
|
* *
|
||||||
* FreeRTOS tutorial books are available in pdf and paperback. *
|
* FreeRTOS provides completely free yet professionally developed, *
|
||||||
* Complete, revised, and edited pdf reference manuals are also *
|
* robust, strictly quality controlled, supported, and cross *
|
||||||
* available. *
|
* platform software that has become a de facto standard. *
|
||||||
* *
|
* *
|
||||||
* Purchasing FreeRTOS documentation will not only help you, by *
|
* Help yourself get started quickly and support the FreeRTOS *
|
||||||
* ensuring you get running as quickly as possible and with an *
|
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||||
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||||
* the FreeRTOS project to continue with its mission of providing *
|
|
||||||
* professional grade, cross platform, de facto standard solutions *
|
|
||||||
* for microcontrollers - completely free of charge! *
|
|
||||||
* *
|
* *
|
||||||
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
* Thank you! *
|
||||||
* *
|
|
||||||
* Thank you for using FreeRTOS, and thank you for your support! *
|
|
||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
This file is part of the FreeRTOS distribution.
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
the terms of the GNU General Public License (version 2) as published by the
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||||
>>>NOTE<<< The modification to the GPL is included to allow you to
|
|
||||||
distribute a combined work that includes FreeRTOS without being obliged to
|
>>! NOTE: The modification to the GPL is included to allow you to distribute
|
||||||
provide the source code for proprietary components outside of the FreeRTOS
|
>>! a combined work that includes FreeRTOS without being obliged to provide
|
||||||
kernel. FreeRTOS is distributed in the hope that it will be useful, but
|
>>! the source code for proprietary components outside of the FreeRTOS
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
>>! kernel.
|
||||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
more details. You should have received a copy of the GNU General Public
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
License and the FreeRTOS license exception along with FreeRTOS; if not it
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||||
by writing to Richard Barry, contact details for whom are available on the
|
link: http://www.freertos.org/a00114.html
|
||||||
FreeRTOS WEB site.
|
|
||||||
|
|
||||||
1 tab == 4 spaces!
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
http://www.FreeRTOS.org - Documentation, latest information, license and
|
***************************************************************************
|
||||||
contact details.
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
http://www.SafeRTOS.com - A version that is certified for use in safety
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
critical systems.
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
http://www.OpenRTOS.com - Commercial support, development, porting,
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
licensing and training services.
|
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||||
|
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||||
|
licenses offer ticketed support, indemnification and middleware.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Standard includes. */
|
/* Standard includes. */
|
||||||
|
|
|
@ -86,15 +86,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
Changes from V4.1.1
|
|
||||||
|
|
||||||
+ The second set of tasks were created the wrong way around. This has been
|
|
||||||
corrected.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
/* Scheduler include files. */
|
/* Scheduler include files. */
|
||||||
|
|
|
@ -387,6 +387,9 @@ static void prvQueueSetReceivingTask( void *pvParameters )
|
||||||
unsigned long ulReceived;
|
unsigned long ulReceived;
|
||||||
xQueueHandle xActivatedQueue;
|
xQueueHandle xActivatedQueue;
|
||||||
|
|
||||||
|
/* Remove compiler warnings. */
|
||||||
|
( void ) pvParameters;
|
||||||
|
|
||||||
/* Create the queues and add them to the queue set before resuming the Tx
|
/* Create the queues and add them to the queue set before resuming the Tx
|
||||||
task. */
|
task. */
|
||||||
prvSetupTest();
|
prvSetupTest();
|
||||||
|
|
|
@ -161,6 +161,11 @@ static void prvTestTask( void *pvParameters );
|
||||||
*/
|
*/
|
||||||
static void prvDemonstrateTaskStateAndHandleGetFunctions( void );
|
static void prvDemonstrateTaskStateAndHandleGetFunctions( void );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A task to demonstrate the use of the xQueueSpacesAvailable() function.
|
||||||
|
*/
|
||||||
|
static void prvDemoQueueSpaceFunctions( void *pvParameters );
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* The variable into which error messages are latched. */
|
/* The variable into which error messages are latched. */
|
||||||
|
@ -191,6 +196,7 @@ int main_full( void )
|
||||||
vStartDynamicPriorityTasks();
|
vStartDynamicPriorityTasks();
|
||||||
vStartQueueSetTasks();
|
vStartQueueSetTasks();
|
||||||
vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY );
|
vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY );
|
||||||
|
xTaskCreate( prvDemoQueueSpaceFunctions, ( signed char * ) "QSpace", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
||||||
|
|
||||||
/* The suicide tasks must be created last as they need to know how many
|
/* The suicide tasks must be created last as they need to know how many
|
||||||
tasks were running prior to their creation. This then allows them to
|
tasks were running prior to their creation. This then allows them to
|
||||||
|
@ -453,4 +459,69 @@ xTaskHandle xTestTask;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void prvDemoQueueSpaceFunctions( void *pvParameters )
|
||||||
|
{
|
||||||
|
xQueueHandle xQueue = NULL;
|
||||||
|
const unsigned portBASE_TYPE uxQueueLength = 10;
|
||||||
|
unsigned portBASE_TYPE uxReturn, x;
|
||||||
|
|
||||||
|
/* Remove compiler warnings. */
|
||||||
|
( void ) pvParameters;
|
||||||
|
|
||||||
|
/* Create the queue that will be used. Nothing is actually going to be
|
||||||
|
sent or received so the queue item size is set to 0. */
|
||||||
|
xQueue = xQueueCreate( uxQueueLength, 0 );
|
||||||
|
configASSERT( xQueue );
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
for( x = 0; x < uxQueueLength; x++ )
|
||||||
|
{
|
||||||
|
/* Ask how many messages are available... */
|
||||||
|
uxReturn = uxQueueMessagesWaiting( xQueue );
|
||||||
|
|
||||||
|
/* Check the number of messages being reported as being available
|
||||||
|
is as expected, and force an assert if not. */
|
||||||
|
if( uxReturn != x )
|
||||||
|
{
|
||||||
|
/* xQueue cannot be NULL so this is deliberately causing an
|
||||||
|
assert to be triggered as there is an error. */
|
||||||
|
configASSERT( xQueue == NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ask how many spaces remain in the queue... */
|
||||||
|
uxReturn = uxQueueSpacesAvailable( xQueue );
|
||||||
|
|
||||||
|
/* Check the number of spaces being reported as being available
|
||||||
|
is as expected, and force an assert if not. */
|
||||||
|
if( uxReturn != ( uxQueueLength - x ) )
|
||||||
|
{
|
||||||
|
/* xQueue cannot be NULL so this is deliberately causing an
|
||||||
|
assert to be triggered as there is an error. */
|
||||||
|
configASSERT( xQueue == NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Fill one more space in the queue. */
|
||||||
|
xQueueSendToBack( xQueue, NULL, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Perform the same check while the queue is full. */
|
||||||
|
uxReturn = uxQueueMessagesWaiting( xQueue );
|
||||||
|
if( uxReturn != uxQueueLength )
|
||||||
|
{
|
||||||
|
configASSERT( xQueue == NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
uxReturn = uxQueueSpacesAvailable( xQueue );
|
||||||
|
|
||||||
|
if( uxReturn != 0 )
|
||||||
|
{
|
||||||
|
configASSERT( xQueue == NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The queue is full, start again. */
|
||||||
|
xQueueReset( xQueue );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -511,6 +511,14 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
|
||||||
#define traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue )
|
#define traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceMALLOC
|
||||||
|
#define traceMALLOC( pvAddress, uiSize )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceFREE
|
||||||
|
#define traceFREE( pvAddress, uiSize )
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef configGENERATE_RUN_TIME_STATS
|
#ifndef configGENERATE_RUN_TIME_STATS
|
||||||
#define configGENERATE_RUN_TIME_STATS 0
|
#define configGENERATE_RUN_TIME_STATS 0
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -107,6 +107,11 @@ void vPortSVCHandler( void ) __attribute__ (( naked ));
|
||||||
*/
|
*/
|
||||||
static void vPortStartFirstTask( void ) __attribute__ (( naked ));
|
static void vPortStartFirstTask( void ) __attribute__ (( naked ));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Used to catch tasks that attempt to return from their implementing function.
|
||||||
|
*/
|
||||||
|
static void prvTaskExitError( void );
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -120,7 +125,9 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
||||||
*pxTopOfStack = portINITIAL_XPSR; /* xPSR */
|
*pxTopOfStack = portINITIAL_XPSR; /* xPSR */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */
|
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */
|
||||||
pxTopOfStack -= 6; /* LR, R12, R3..R1 */
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( portSTACK_TYPE ) prvTaskExitError; /* LR */
|
||||||
|
pxTopOfStack -= 5; /* R12, R3, R2 and R1. */
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */
|
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */
|
||||||
pxTopOfStack -= 8; /* R11..R4. */
|
pxTopOfStack -= 8; /* R11..R4. */
|
||||||
|
|
||||||
|
@ -128,6 +135,20 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void prvTaskExitError( void )
|
||||||
|
{
|
||||||
|
/* A function that implements a task must not exit or attempt to return to
|
||||||
|
its caller as there is nothing to return to. If a task wants to exit it
|
||||||
|
should instead call vTaskDelete( NULL ).
|
||||||
|
|
||||||
|
Artificially force an assert() to be triggered if configASSERT() is
|
||||||
|
defined, then stop here so application writers can catch the error. */
|
||||||
|
configASSERT( uxCriticalNesting == ~0UL );
|
||||||
|
portDISABLE_INTERRUPTS();
|
||||||
|
for( ;; );
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vPortSVCHandler( void )
|
void vPortSVCHandler( void )
|
||||||
{
|
{
|
||||||
__asm volatile (
|
__asm volatile (
|
||||||
|
@ -250,6 +271,9 @@ void vClearInterruptMaskFromISR( unsigned long ulMask )
|
||||||
" msr PRIMASK, r0 \n"
|
" msr PRIMASK, r0 \n"
|
||||||
" bx lr "
|
" bx lr "
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/* Just to avoid compiler warning. */
|
||||||
|
( void ) ulMask;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -113,6 +113,11 @@ void xPortSysTickHandler( void );
|
||||||
*/
|
*/
|
||||||
extern void vPortStartFirstTask( void );
|
extern void vPortStartFirstTask( void );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Used to catch tasks that attempt to return from their implementing function.
|
||||||
|
*/
|
||||||
|
static void prvTaskExitError( void );
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -126,7 +131,9 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
||||||
*pxTopOfStack = portINITIAL_XPSR; /* xPSR */
|
*pxTopOfStack = portINITIAL_XPSR; /* xPSR */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */
|
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */
|
||||||
pxTopOfStack -= 6; /* LR, R12, R3..R1 */
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( portSTACK_TYPE ) prvTaskExitError; /* LR */
|
||||||
|
pxTopOfStack -= 5; /* R12, R3, R2 and R1. */
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */
|
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */
|
||||||
pxTopOfStack -= 8; /* R11..R4. */
|
pxTopOfStack -= 8; /* R11..R4. */
|
||||||
|
|
||||||
|
@ -134,6 +141,20 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void prvTaskExitError( void )
|
||||||
|
{
|
||||||
|
/* A function that implements a task must not exit or attempt to return to
|
||||||
|
its caller as there is nothing to return to. If a task wants to exit it
|
||||||
|
should instead call vTaskDelete( NULL ).
|
||||||
|
|
||||||
|
Artificially force an assert() to be triggered if configASSERT() is
|
||||||
|
defined, then stop here so application writers can catch the error. */
|
||||||
|
configASSERT( uxCriticalNesting == ~0UL );
|
||||||
|
portDISABLE_INTERRUPTS();
|
||||||
|
for( ;; );
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* See header file for description.
|
* See header file for description.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -110,6 +110,11 @@ void vPortSVCHandler( void );
|
||||||
*/
|
*/
|
||||||
static void prvPortStartFirstTask( void );
|
static void prvPortStartFirstTask( void );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Used to catch tasks that attempt to return from their implementing function.
|
||||||
|
*/
|
||||||
|
static void prvTaskExitError( void );
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -123,7 +128,9 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
||||||
*pxTopOfStack = portINITIAL_XPSR; /* xPSR */
|
*pxTopOfStack = portINITIAL_XPSR; /* xPSR */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */
|
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */
|
||||||
pxTopOfStack -= 6; /* LR, R12, R3..R1 */
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( portSTACK_TYPE ) prvTaskExitError; /* LR */
|
||||||
|
pxTopOfStack -= 5; /* R12, R3, R2 and R1. */
|
||||||
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */
|
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R0 */
|
||||||
pxTopOfStack -= 8; /* R11..R4. */
|
pxTopOfStack -= 8; /* R11..R4. */
|
||||||
|
|
||||||
|
@ -131,6 +138,20 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void prvTaskExitError( void )
|
||||||
|
{
|
||||||
|
/* A function that implements a task must not exit or attempt to return to
|
||||||
|
its caller as there is nothing to return to. If a task wants to exit it
|
||||||
|
should instead call vTaskDelete( NULL ).
|
||||||
|
|
||||||
|
Artificially force an assert() to be triggered if configASSERT() is
|
||||||
|
defined, then stop here so application writers can catch the error. */
|
||||||
|
configASSERT( uxCriticalNesting == ~0UL );
|
||||||
|
portDISABLE_INTERRUPTS();
|
||||||
|
for( ;; );
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
__asm void vPortSVCHandler( void )
|
__asm void vPortSVCHandler( void )
|
||||||
{
|
{
|
||||||
extern pxCurrentTCB;
|
extern pxCurrentTCB;
|
||||||
|
|
|
@ -89,7 +89,7 @@ privileged Vs unprivileged linkage and placement. */
|
||||||
uxTaskGetSystemState() function. Note the formatting functions are provided
|
uxTaskGetSystemState() function. Note the formatting functions are provided
|
||||||
for convenience only, and are NOT considered part of the kernel. */
|
for convenience only, and are NOT considered part of the kernel. */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif /* ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS == 1 ) ) */
|
#endif /* configUSE_STATS_FORMATTING_FUNCTIONS == 1 ) */
|
||||||
|
|
||||||
/* Sanity check the configuration. */
|
/* Sanity check the configuration. */
|
||||||
#if configUSE_TICKLESS_IDLE != 0
|
#if configUSE_TICKLESS_IDLE != 0
|
||||||
|
@ -1196,7 +1196,11 @@ tskTCB * pxNewTCB;
|
||||||
|
|
||||||
if( uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE )
|
if( uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE )
|
||||||
{
|
{
|
||||||
xYieldRequired = ( pxTCB->uxPriority >= pxCurrentTCB->uxPriority );
|
if( pxTCB->uxPriority >= pxCurrentTCB->uxPriority )
|
||||||
|
{
|
||||||
|
xYieldRequired = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
( void ) uxListRemove( &( pxTCB->xGenericListItem ) );
|
( void ) uxListRemove( &( pxTCB->xGenericListItem ) );
|
||||||
prvAddTaskToReadyList( pxTCB );
|
prvAddTaskToReadyList( pxTCB );
|
||||||
}
|
}
|
||||||
|
@ -1250,12 +1254,17 @@ portBASE_TYPE xReturn;
|
||||||
before or during the call to xPortStartScheduler(). The stacks of
|
before or during the call to xPortStartScheduler(). The stacks of
|
||||||
the created tasks contain a status word with interrupts switched on
|
the created tasks contain a status word with interrupts switched on
|
||||||
so interrupts will automatically get re-enabled when the first task
|
so interrupts will automatically get re-enabled when the first task
|
||||||
starts to run.
|
starts to run. */
|
||||||
|
|
||||||
STEPPING THROUGH HERE USING A DEBUGGER CAN CAUSE BIG PROBLEMS IF THE
|
|
||||||
DEBUGGER ALLOWS INTERRUPTS TO BE PROCESSED. */
|
|
||||||
portDISABLE_INTERRUPTS();
|
portDISABLE_INTERRUPTS();
|
||||||
|
|
||||||
|
#if ( configUSE_NEWLIB_REENTRANT == 1 )
|
||||||
|
{
|
||||||
|
/* Switch Newlib's _impure_ptr variable to point to the _reent
|
||||||
|
structure specific to the task that will run first. */
|
||||||
|
_impure_ptr = &( pxCurrentTCB->xNewLib_reent );
|
||||||
|
}
|
||||||
|
#endif /* configUSE_NEWLIB_REENTRANT */
|
||||||
|
|
||||||
xSchedulerRunning = pdTRUE;
|
xSchedulerRunning = pdTRUE;
|
||||||
xTickCount = ( portTickType ) 0U;
|
xTickCount = ( portTickType ) 0U;
|
||||||
|
|
||||||
|
@ -1337,7 +1346,6 @@ signed portBASE_TYPE xTaskResumeAll( void )
|
||||||
{
|
{
|
||||||
tskTCB *pxTCB;
|
tskTCB *pxTCB;
|
||||||
portBASE_TYPE xAlreadyYielded = pdFALSE;
|
portBASE_TYPE xAlreadyYielded = pdFALSE;
|
||||||
portBASE_TYPE xYieldRequired = pdFALSE;
|
|
||||||
|
|
||||||
/* If uxSchedulerSuspended is zero then this function does not match a
|
/* If uxSchedulerSuspended is zero then this function does not match a
|
||||||
previous call to vTaskSuspendAll(). */
|
previous call to vTaskSuspendAll(). */
|
||||||
|
@ -1369,7 +1377,7 @@ portBASE_TYPE xYieldRequired = pdFALSE;
|
||||||
the current task then we should yield. */
|
the current task then we should yield. */
|
||||||
if( pxTCB->uxPriority >= pxCurrentTCB->uxPriority )
|
if( pxTCB->uxPriority >= pxCurrentTCB->uxPriority )
|
||||||
{
|
{
|
||||||
xYieldRequired = pdTRUE;
|
xYieldPending = pdTRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1382,16 +1390,15 @@ portBASE_TYPE xYieldRequired = pdFALSE;
|
||||||
{
|
{
|
||||||
if( xTaskIncrementTick() != pdFALSE )
|
if( xTaskIncrementTick() != pdFALSE )
|
||||||
{
|
{
|
||||||
xYieldRequired = pdTRUE;
|
xYieldPending = pdTRUE;
|
||||||
}
|
}
|
||||||
--uxPendedTicks;
|
--uxPendedTicks;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( xYieldRequired == pdTRUE ) || ( xYieldPending == pdTRUE ) )
|
if( xYieldPending == pdTRUE )
|
||||||
{
|
{
|
||||||
xAlreadyYielded = pdTRUE;
|
xAlreadyYielded = pdTRUE;
|
||||||
xYieldPending = pdFALSE;
|
|
||||||
portYIELD_WITHIN_API();
|
portYIELD_WITHIN_API();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1678,6 +1685,17 @@ portBASE_TYPE xSwitchRequired = pdFALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* ( ( configUSE_PREEMPTION == 1 ) && ( configUSE_TIME_SLICING == 1 ) ) */
|
#endif /* ( ( configUSE_PREEMPTION == 1 ) && ( configUSE_TIME_SLICING == 1 ) ) */
|
||||||
|
|
||||||
|
#if ( configUSE_TICK_HOOK == 1 )
|
||||||
|
{
|
||||||
|
/* Guard against the tick hook being called when the pended tick
|
||||||
|
count is being unwound (when the scheduler is being unlocked). */
|
||||||
|
if( uxPendedTicks == ( unsigned portBASE_TYPE ) 0U )
|
||||||
|
{
|
||||||
|
vApplicationTickHook();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* configUSE_TICK_HOOK */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1692,16 +1710,14 @@ portBASE_TYPE xSwitchRequired = pdFALSE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ( configUSE_TICK_HOOK == 1 )
|
#if ( configUSE_PREEMPTION == 1 )
|
||||||
{
|
{
|
||||||
/* Guard against the tick hook being called when the missed tick
|
if( xYieldPending != pdFALSE )
|
||||||
count is being unwound (when the scheduler is being unlocked). */
|
|
||||||
if( uxPendedTicks == ( unsigned portBASE_TYPE ) 0U )
|
|
||||||
{
|
{
|
||||||
vApplicationTickHook();
|
xSwitchRequired = pdTRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* configUSE_TICK_HOOK */
|
#endif /* configUSE_PREEMPTION */
|
||||||
|
|
||||||
return xSwitchRequired;
|
return xSwitchRequired;
|
||||||
}
|
}
|
||||||
|
@ -1804,6 +1820,7 @@ void vTaskSwitchContext( void )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
xYieldPending = pdFALSE;
|
||||||
traceTASK_SWITCHED_OUT();
|
traceTASK_SWITCHED_OUT();
|
||||||
|
|
||||||
#if ( configGENERATE_RUN_TIME_STATS == 1 )
|
#if ( configGENERATE_RUN_TIME_STATS == 1 )
|
||||||
|
@ -1981,6 +1998,10 @@ portBASE_TYPE xReturn;
|
||||||
the calling task to know if it should force a context
|
the calling task to know if it should force a context
|
||||||
switch now. */
|
switch now. */
|
||||||
xReturn = pdTRUE;
|
xReturn = pdTRUE;
|
||||||
|
|
||||||
|
/* Mark that a yield is pending in case the user is not using the
|
||||||
|
"xHigherPriorityTaskWoken" parameter to an ISR safe FreeRTOS function. */
|
||||||
|
xYieldPending = pdTRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -569,6 +569,13 @@ portTickType xTimeNow;
|
||||||
case tmrCOMMAND_CHANGE_PERIOD :
|
case tmrCOMMAND_CHANGE_PERIOD :
|
||||||
pxTimer->xTimerPeriodInTicks = xMessage.xMessageValue;
|
pxTimer->xTimerPeriodInTicks = xMessage.xMessageValue;
|
||||||
configASSERT( ( pxTimer->xTimerPeriodInTicks > 0 ) );
|
configASSERT( ( pxTimer->xTimerPeriodInTicks > 0 ) );
|
||||||
|
|
||||||
|
/* The new period does not really have a reference, and can be
|
||||||
|
longer or shorter than the old one. The command time is
|
||||||
|
therefore set to the current time, and as the period cannot be
|
||||||
|
zero the next expiry time can only be in the future, meaning
|
||||||
|
(unlike for the xTimerStart() case above) there is no fail case
|
||||||
|
that needs to be handled here. */
|
||||||
( void ) prvInsertTimerInActiveList( pxTimer, ( xTimeNow + pxTimer->xTimerPeriodInTicks ), xTimeNow, xTimeNow );
|
( void ) prvInsertTimerInActiveList( pxTimer, ( xTimeNow + pxTimer->xTimerPeriodInTicks ), xTimeNow, xTimeNow );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue