/*\r
- FreeRTOS V8.0.0:rc1 - Copyright (C) 2014 Real Time Engineers Ltd. \r
+ FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. \r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
the terms of the GNU General Public License (version 2) as published by the\r
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
\r
- >>! NOTE: The modification to the GPL is included to allow you to distribute\r
- >>! a combined work that includes FreeRTOS without being obliged to provide\r
- >>! the source code for proprietary components outside of the FreeRTOS\r
- >>! kernel.\r
+ >>! NOTE: The modification to the GPL is included to allow you to !<<\r
+ >>! distribute a combined work that includes FreeRTOS without being !<<\r
+ >>! obliged to provide the source code for proprietary components !<<\r
+ >>! outside of the FreeRTOS kernel. !<<\r
\r
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
#error configTIMER_TASK_PRIORITY must be set to at least 1 for this test/demo to function correctly.\r
#endif\r
\r
-#define tmrdemoDONT_BLOCK ( ( portTickType ) 0 )\r
-#define tmrdemoONE_SHOT_TIMER_PERIOD ( xBasePeriod * ( portTickType ) 3 )\r
+#define tmrdemoDONT_BLOCK ( ( TickType_t ) 0 )\r
+#define tmrdemoONE_SHOT_TIMER_PERIOD ( xBasePeriod * ( TickType_t ) 3 )\r
#define trmdemoNUM_TIMER_RESETS ( ( unsigned char ) 10 )\r
\r
/*-----------------------------------------------------------*/\r
pxExpiredTimer parameter passed into that function to know which counter to\r
increment. The other timers all have their own unique callback function and\r
simply increment their counters without using the callback function parameter. */\r
-static void prvAutoReloadTimerCallback( xTimerHandle pxExpiredTimer );\r
-static void prvOneShotTimerCallback( xTimerHandle pxExpiredTimer );\r
+static void prvAutoReloadTimerCallback( TimerHandle_t pxExpiredTimer );\r
+static void prvOneShotTimerCallback( TimerHandle_t pxExpiredTimer );\r
static void prvTimerTestTask( void *pvParameters );\r
-static void prvISRAutoReloadTimerCallback( xTimerHandle pxExpiredTimer );\r
-static void prvISROneShotTimerCallback( xTimerHandle pxExpiredTimer );\r
+static void prvISRAutoReloadTimerCallback( TimerHandle_t pxExpiredTimer );\r
+static void prvISROneShotTimerCallback( TimerHandle_t pxExpiredTimer );\r
\r
/* The test functions used by the timer test task. These manipulate the auto\r
reload and one shot timers in various ways, then delay, then inspect the timers\r
The callback function uses the timer ID to index into, and then increment, a\r
counter in the ucAutoReloadTimerCounters[] array. The auto reload timers\r
referenced from xAutoReloadTimers[] are used by the prvTimerTestTask task. */\r
-static xTimerHandle xAutoReloadTimers[ configTIMER_QUEUE_LENGTH + 1 ] = { 0 };\r
+static TimerHandle_t xAutoReloadTimers[ configTIMER_QUEUE_LENGTH + 1 ] = { 0 };\r
static unsigned char ucAutoReloadTimerCounters[ configTIMER_QUEUE_LENGTH + 1 ] = { 0 };\r
\r
/* The one shot timer is configured to use a callback function that increments\r
ucOneShotTimerCounter each time it gets called. */\r
-static xTimerHandle xOneShotTimer = NULL;\r
+static TimerHandle_t xOneShotTimer = NULL;\r
static unsigned char ucOneShotTimerCounter = ( unsigned char ) 0;\r
\r
/* The ISR reload timer is controlled from the tick hook to exercise the timer\r
API functions that can be used from an ISR. It is configured to increment\r
ucISRReloadTimerCounter each time its callback function is executed. */\r
-static xTimerHandle xISRAutoReloadTimer = NULL;\r
+static TimerHandle_t xISRAutoReloadTimer = NULL;\r
static unsigned char ucISRAutoReloadTimerCounter = ( unsigned char ) 0;\r
\r
/* The ISR one shot timer is controlled from the tick hook to exercise the timer\r
API functions that can be used from an ISR. It is configured to increment\r
ucISRReloadTimerCounter each time its callback function is executed. */\r
-static xTimerHandle xISROneShotTimer = NULL;\r
+static TimerHandle_t xISROneShotTimer = NULL;\r
static unsigned char ucISROneShotTimerCounter = ( unsigned char ) 0;\r
\r
/* The period of all the timers are a multiple of the base period. The base\r
period is configured by the parameter to vStartTimerDemoTask(). */\r
-static portTickType xBasePeriod = 0;\r
+static TickType_t xBasePeriod = 0;\r
\r
/*-----------------------------------------------------------*/\r
\r
-void vStartTimerDemoTask( portTickType xBasePeriodIn )\r
+void vStartTimerDemoTask( TickType_t xBasePeriodIn )\r
{\r
/* Start with the timer and counter arrays clear - this is only necessary\r
where the compiler does not clear them automatically on start up. */\r
\r
/* This is called to check that the created task is still running and has not\r
detected any errors. */\r
-portBASE_TYPE xAreTimerDemoTasksStillRunning( portTickType xCycleFrequency )\r
+portBASE_TYPE xAreTimerDemoTasksStillRunning( TickType_t xCycleFrequency )\r
{\r
static unsigned long ulLastLoopCounter = 0UL;\r
-portTickType xMaxBlockTimeUsedByTheseTests, xLoopCounterIncrementTimeMax;\r
-static portTickType xIterationsWithoutCounterIncrement = ( portTickType ) 0, xLastCycleFrequency;\r
+TickType_t xMaxBlockTimeUsedByTheseTests, xLoopCounterIncrementTimeMax;\r
+static TickType_t xIterationsWithoutCounterIncrement = ( TickType_t ) 0, xLastCycleFrequency;\r
\r
if( xLastCycleFrequency != xCycleFrequency )\r
{\r
/* The cycle frequency has probably become much faster due to an error\r
elsewhere. Start counting Iterations again. */\r
- xIterationsWithoutCounterIncrement = ( portTickType ) 0;\r
+ xIterationsWithoutCounterIncrement = ( TickType_t ) 0;\r
xLastCycleFrequency = xCycleFrequency;\r
} \r
\r
function to be called without ulLoopCounter being incremented. This is\r
necessary because the tests in this file block for extended periods, and the\r
block period might be longer than the time between calls to this function. */\r
- xMaxBlockTimeUsedByTheseTests = ( ( portTickType ) configTIMER_QUEUE_LENGTH ) * xBasePeriod;\r
+ xMaxBlockTimeUsedByTheseTests = ( ( TickType_t ) configTIMER_QUEUE_LENGTH ) * xBasePeriod;\r
xLoopCounterIncrementTimeMax = ( xMaxBlockTimeUsedByTheseTests / xCycleFrequency ) + 1;\r
\r
/* If the demo task is still running then the loop counter is expected to\r
{\r
/* ulLoopCounter changed, so the count of times this function was called\r
without a change can be reset to zero. */\r
- xIterationsWithoutCounterIncrement = ( portTickType ) 0;\r
+ xIterationsWithoutCounterIncrement = ( TickType_t ) 0;\r
}\r
\r
ulLastLoopCounter = ulLoopCounter;\r
been started, so their block times should get set to zero within the timer\r
API itself. */\r
xAutoReloadTimers[ xTimer ] = xTimerCreate( "FR Timer", /* Text name to facilitate debugging. The kernel does not use this itself. */\r
- ( ( xTimer + ( portTickType ) 1 ) * xBasePeriod ),/* The period for the timer. The plus 1 ensures a period of zero is not specified. */\r
+ ( ( xTimer + ( TickType_t ) 1 ) * xBasePeriod ),/* The period for the timer. The plus 1 ensures a period of zero is not specified. */\r
pdTRUE, /* Auto-reload is set to true. */\r
( void * ) xTimer, /* An identifier for the timer as all the auto reload timers use the same callback. */\r
prvAutoReloadTimerCallback ); /* The callback to be called when the timer expires. */\r
\r
+ configASSERT( strcmp( pcTimerGetTimerName( xAutoReloadTimers[ xTimer ] ), "FR Timer" ) == 0 );\r
+\r
if( xAutoReloadTimers[ xTimer ] == NULL )\r
{\r
xTestStatus = pdFAIL;\r
static void prvTest3_CheckAutoReloadExpireRates( void )\r
{\r
unsigned char ucMaxAllowableValue, ucMinAllowableValue, ucTimer;\r
-portTickType xBlockPeriod, xTimerPeriod, xExpectedNumber;\r
+TickType_t xBlockPeriod, xTimerPeriod, xExpectedNumber;\r
\r
/* Check the auto reload timers expire at the expected rates. */\r
\r
\r
/* Delaying for configTIMER_QUEUE_LENGTH * xBasePeriod ticks should allow\r
all the auto reload timers to expire at least once. */\r
- xBlockPeriod = ( ( portTickType ) configTIMER_QUEUE_LENGTH ) * xBasePeriod;\r
+ xBlockPeriod = ( ( TickType_t ) configTIMER_QUEUE_LENGTH ) * xBasePeriod;\r
vTaskDelay( xBlockPeriod );\r
\r
/* Check that all the auto reload timers have called their callback \r
{\r
/* The expected number of expiries is equal to the block period divided\r
by the timer period. */\r
- xTimerPeriod = ( ( ( portTickType ) ucTimer + ( portTickType ) 1 ) * xBasePeriod );\r
+ xTimerPeriod = ( ( ( TickType_t ) ucTimer + ( TickType_t ) 1 ) * xBasePeriod );\r
xExpectedNumber = xBlockPeriod / xTimerPeriod;\r
\r
ucMaxAllowableValue = ( ( unsigned char ) xExpectedNumber ) ;\r
\r
/* The timers are now all inactive, so this time, after delaying, none\r
of the callback counters should have incremented. */\r
- vTaskDelay( ( ( portTickType ) configTIMER_QUEUE_LENGTH ) * xBasePeriod );\r
+ vTaskDelay( ( ( TickType_t ) configTIMER_QUEUE_LENGTH ) * xBasePeriod );\r
for( ucTimer = 0; ucTimer < ( unsigned char ) configTIMER_QUEUE_LENGTH; ucTimer++ )\r
{\r
if( ucAutoReloadTimerCounters[ ucTimer ] != ( unsigned char ) 0 )\r
/* Delay for three times as long as the one shot timer period, then check\r
to ensure it has only called its callback once, and is now not in the\r
active state. */\r
- vTaskDelay( tmrdemoONE_SHOT_TIMER_PERIOD * ( portTickType ) 3 );\r
+ vTaskDelay( tmrdemoONE_SHOT_TIMER_PERIOD * ( TickType_t ) 3 );\r
\r
if( xTimerIsTimerActive( xOneShotTimer ) != pdFALSE )\r
{\r
}\r
\r
/* Finally delay long enough for both running timers to expire. */\r
- vTaskDelay( ( ( portTickType ) configTIMER_QUEUE_LENGTH ) * xBasePeriod );\r
+ vTaskDelay( ( ( TickType_t ) configTIMER_QUEUE_LENGTH ) * xBasePeriod );\r
\r
/* The timers were not reset during the above delay period so should now\r
both have called their callback functions. */\r
\r
void vTimerPeriodicISRTests( void )\r
{\r
-static portTickType uxTick = ( portTickType ) -1;\r
+static TickType_t uxTick = ( TickType_t ) -1;\r
\r
#if( configTIMER_TASK_PRIORITY != ( configMAX_PRIORITIES - 1 ) )\r
/* The timer service task is not the highest priority task, so it cannot\r
will expire when the kernel's tick count is (100 + xBasePeriod). For this\r
reason xMargin is used as an allowable margin for premature timer expiries\r
as well as late timer expiries. */\r
- const portTickType xMargin = 5;\r
+ const TickType_t xMargin = 6;\r
#else\r
- const portTickType xMargin = 2;\r
+ const TickType_t xMargin = 3;\r
#endif\r
\r
\r
/* It is possible that the timer task has not yet made room in the\r
timer queue. If the timers cannot be started then reset uxTick so\r
another attempt is made later. */\r
- uxTick = ( portTickType ) -1;\r
+ uxTick = ( TickType_t ) -1;\r
\r
/* Try starting first timer. */\r
if( xTimerChangePeriodFromISR( xISRAutoReloadTimer, xBasePeriod, NULL ) == pdPASS )\r
configASSERT( xTestStatus );\r
}\r
}\r
- else if( uxTick == ( ( 2 * xBasePeriod ) + ( xBasePeriod >> ( portTickType ) 2U ) ) )\r
+ else if( uxTick == ( ( 2 * xBasePeriod ) + ( xBasePeriod >> ( TickType_t ) 2U ) ) )\r
{\r
/* The auto reload timer will still be active, but the one shot timer\r
should now have stopped. Again though, at this time, neither timer call\r
configASSERT( xTestStatus );\r
}\r
\r
- uxTick = ( portTickType ) -1;\r
+ uxTick = ( TickType_t ) -1;\r
} \r
}\r
/*-----------------------------------------------------------*/\r
\r
/*** Timer callback functions are defined below here. ***/\r
\r
-static void prvAutoReloadTimerCallback( xTimerHandle pxExpiredTimer )\r
+static void prvAutoReloadTimerCallback( TimerHandle_t pxExpiredTimer )\r
{\r
unsigned long ulTimerID;\r
\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static void prvOneShotTimerCallback( xTimerHandle pxExpiredTimer )\r
+static void prvOneShotTimerCallback( TimerHandle_t pxExpiredTimer )\r
{\r
/* The parameter is not used in this case as only one timer uses this\r
callback function. */\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static void prvISRAutoReloadTimerCallback( xTimerHandle pxExpiredTimer )\r
+static void prvISRAutoReloadTimerCallback( TimerHandle_t pxExpiredTimer )\r
{\r
/* The parameter is not used in this case as only one timer uses this\r
callback function. */\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static void prvISROneShotTimerCallback( xTimerHandle pxExpiredTimer )\r
+static void prvISROneShotTimerCallback( TimerHandle_t pxExpiredTimer )\r
{\r
/* The parameter is not used in this case as only one timer uses this\r
callback function. */\r