]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/Common/Minimal/TimerDemo.c
Update version numbers to V7.4.1.
[freertos] / FreeRTOS / Demo / Common / Minimal / TimerDemo.c
1 /*\r
2     FreeRTOS V7.4.1 - Copyright (C) 2013 Real Time Engineers Ltd.\r
3 \r
4     FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME.  PLEASE VISIT\r
5     http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
6 \r
7     ***************************************************************************\r
8      *                                                                       *\r
9      *    FreeRTOS tutorial books are available in pdf and paperback.        *\r
10      *    Complete, revised, and edited pdf reference manuals are also       *\r
11      *    available.                                                         *\r
12      *                                                                       *\r
13      *    Purchasing FreeRTOS documentation will not only help you, by       *\r
14      *    ensuring you get running as quickly as possible and with an        *\r
15      *    in-depth knowledge of how to use FreeRTOS, it will also help       *\r
16      *    the FreeRTOS project to continue with its mission of providing     *\r
17      *    professional grade, cross platform, de facto standard solutions    *\r
18      *    for microcontrollers - completely free of charge!                  *\r
19      *                                                                       *\r
20      *    >>> See http://www.FreeRTOS.org/Documentation for details. <<<     *\r
21      *                                                                       *\r
22      *    Thank you for using FreeRTOS, and thank you for your support!      *\r
23      *                                                                       *\r
24     ***************************************************************************\r
25 \r
26 \r
27     This file is part of the FreeRTOS distribution.\r
28 \r
29     FreeRTOS is free software; you can redistribute it and/or modify it under\r
30     the terms of the GNU General Public License (version 2) as published by the\r
31     Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
32 \r
33     >>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to\r
34     distribute a combined work that includes FreeRTOS without being obliged to\r
35     provide the source code for proprietary components outside of the FreeRTOS\r
36     kernel.\r
37 \r
38     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
39     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
40     FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\r
41     details. You should have received a copy of the GNU General Public License\r
42     and the FreeRTOS license exception along with FreeRTOS; if not it can be\r
43     viewed here: http://www.freertos.org/a00114.html and also obtained by\r
44     writing to Real Time Engineers Ltd., contact details for whom are available\r
45     on the FreeRTOS WEB site.\r
46 \r
47     1 tab == 4 spaces!\r
48 \r
49     ***************************************************************************\r
50      *                                                                       *\r
51      *    Having a problem?  Start by reading the FAQ "My application does   *\r
52      *    not run, what could be wrong?"                                     *\r
53      *                                                                       *\r
54      *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
55      *                                                                       *\r
56     ***************************************************************************\r
57 \r
58 \r
59     http://www.FreeRTOS.org - Documentation, books, training, latest versions, \r
60     license and Real Time Engineers Ltd. contact details.\r
61 \r
62     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
63     including FreeRTOS+Trace - an indispensable productivity tool, and our new\r
64     fully thread aware and reentrant UDP/IP stack.\r
65 \r
66     http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High \r
67     Integrity Systems, who sell the code with commercial support, \r
68     indemnification and middleware, under the OpenRTOS brand.\r
69     \r
70     http://www.SafeRTOS.com - High Integrity Systems also provide a safety \r
71     engineered and independently SIL3 certified version for use in safety and \r
72     mission critical applications that require provable dependability.\r
73 */\r
74 \r
75 \r
76 /*\r
77  * Tests the behaviour of timers.  Some timers are created before the scheduler\r
78  * is started, and some after.\r
79  */\r
80 \r
81 /* Standard includes. */\r
82 #include <string.h>\r
83 \r
84 /* Scheduler include files. */\r
85 #include "FreeRTOS.h"\r
86 #include "task.h"\r
87 #include "timers.h"\r
88 \r
89 /* Demo program include files. */\r
90 #include "TimerDemo.h"\r
91 \r
92 #if ( configTIMER_TASK_PRIORITY < 1 )\r
93         #error configTIMER_TASK_PRIORITY must be set to at least 1 for this test/demo to function correctly.\r
94 #endif\r
95 \r
96 #define tmrdemoDONT_BLOCK                               ( ( portTickType ) 0 )\r
97 #define tmrdemoONE_SHOT_TIMER_PERIOD    ( xBasePeriod * ( portTickType ) 3 )\r
98 #define trmdemoNUM_TIMER_RESETS                 ( ( unsigned char ) 10 )\r
99 \r
100 /*-----------------------------------------------------------*/\r
101 \r
102 /* The callback functions used by the timers.  These each increment a counter\r
103 to indicate which timer has expired.  The auto-reload timers that are used by\r
104 the test task (as opposed to being used from an ISR) all share the same\r
105 prvAutoReloadTimerCallback() callback function, and use the ID of the\r
106 pxExpiredTimer parameter passed into that function to know which counter to\r
107 increment.  The other timers all have their own unique callback function and\r
108 simply increment their counters without using the callback function parameter. */\r
109 static void prvAutoReloadTimerCallback( xTimerHandle pxExpiredTimer );\r
110 static void prvOneShotTimerCallback( xTimerHandle pxExpiredTimer );\r
111 static void prvTimerTestTask( void *pvParameters );\r
112 static void prvISRAutoReloadTimerCallback( xTimerHandle pxExpiredTimer );\r
113 static void prvISROneShotTimerCallback( xTimerHandle pxExpiredTimer );\r
114 \r
115 /* The test functions used by the timer test task.  These manipulate the auto\r
116 reload and one shot timers in various ways, then delay, then inspect the timers\r
117 to ensure they have behaved as expected. */\r
118 static void prvTest1_CreateTimersWithoutSchedulerRunning( void );\r
119 static void prvTest2_CheckTaskAndTimersInitialState( void );\r
120 static void     prvTest3_CheckAutoReloadExpireRates( void );\r
121 static void prvTest4_CheckAutoReloadTimersCanBeStopped( void );\r
122 static void prvTest5_CheckBasicOneShotTimerBehaviour( void );\r
123 static void prvTest6_CheckAutoReloadResetBehaviour( void );\r
124 static void prvResetStartConditionsForNextIteration( void );\r
125 \r
126 /*-----------------------------------------------------------*/\r
127 \r
128 /* Flag that will be latched to pdFAIL should any unexpected behaviour be\r
129 detected in any of the demo tests. */\r
130 static volatile portBASE_TYPE xTestStatus = pdPASS;\r
131 \r
132 /* Counter that is incremented on each cycle of a test.  This is used to\r
133 detect a stalled task - a test that is no longer running. */\r
134 static volatile unsigned long ulLoopCounter = 0;\r
135 \r
136 /* A set of auto reload timers - each of which use the same callback function.\r
137 The callback function uses the timer ID to index into, and then increment, a\r
138 counter in the ucAutoReloadTimerCounters[] array.  The auto reload timers\r
139 referenced from xAutoReloadTimers[] are used by the prvTimerTestTask task. */\r
140 static xTimerHandle xAutoReloadTimers[ configTIMER_QUEUE_LENGTH + 1 ] = { 0 };\r
141 static unsigned char ucAutoReloadTimerCounters[ configTIMER_QUEUE_LENGTH + 1 ] = { 0 };\r
142 \r
143 /* The one shot timer is configured to use a callback function that increments\r
144 ucOneShotTimerCounter each time it gets called. */\r
145 static xTimerHandle xOneShotTimer = NULL;\r
146 static unsigned char ucOneShotTimerCounter = ( unsigned char ) 0;\r
147 \r
148 /* The ISR reload timer is controlled from the tick hook to exercise the timer\r
149 API functions that can be used from an ISR.  It is configured to increment\r
150 ucISRReloadTimerCounter each time its callback function is executed. */\r
151 static xTimerHandle xISRAutoReloadTimer = NULL;\r
152 static unsigned char ucISRAutoReloadTimerCounter = ( unsigned char ) 0;\r
153 \r
154 /* The ISR one shot timer is controlled from the tick hook to exercise the timer\r
155 API functions that can be used from an ISR.  It is configured to increment\r
156 ucISRReloadTimerCounter each time its callback function is executed. */\r
157 static xTimerHandle xISROneShotTimer = NULL;\r
158 static unsigned char ucISROneShotTimerCounter = ( unsigned char ) 0;\r
159 \r
160 /* The period of all the timers are a multiple of the base period.  The base\r
161 period is configured by the parameter to vStartTimerDemoTask(). */\r
162 static portTickType xBasePeriod = 0;\r
163 \r
164 /*-----------------------------------------------------------*/\r
165 \r
166 void vStartTimerDemoTask( portTickType xBasePeriodIn )\r
167 {\r
168         /* Start with the timer and counter arrays clear - this is only necessary\r
169         where the compiler does not clear them automatically on start up. */\r
170         memset( ucAutoReloadTimerCounters, 0x00, sizeof( ucAutoReloadTimerCounters ) );\r
171         memset( xAutoReloadTimers, 0x00, sizeof( xAutoReloadTimers ) );\r
172 \r
173         /* Store the period from which all the timer periods will be generated from\r
174         (multiples of). */\r
175         xBasePeriod = xBasePeriodIn;\r
176 \r
177         /* Create a set of timers for use by this demo/test. */\r
178         prvTest1_CreateTimersWithoutSchedulerRunning();\r
179 \r
180         /* Create the task that will control and monitor the timers.  This is\r
181         created at a lower priority than the timer service task to ensure, as\r
182         far as it is concerned, commands on timers are actioned immediately\r
183         (sending a command to the timer service task will unblock the timer service\r
184         task, which will then preempt this task). */\r
185         if( xTestStatus != pdFAIL )\r
186         {\r
187                 xTaskCreate( prvTimerTestTask, ( signed portCHAR * ) "Tmr Tst", configMINIMAL_STACK_SIZE, NULL, configTIMER_TASK_PRIORITY - 1, NULL );\r
188         }\r
189 }\r
190 /*-----------------------------------------------------------*/\r
191 \r
192 static void prvTimerTestTask( void *pvParameters )\r
193 {\r
194         ( void ) pvParameters;\r
195 \r
196         /* Create a one-shot timer for use later on in this test. */\r
197         xOneShotTimer = xTimerCreate(   ( const signed char * ) "Oneshot Timer",/* Text name to facilitate debugging.  The kernel does not use this itself. */\r
198                                                                         tmrdemoONE_SHOT_TIMER_PERIOD,                   /* The period for the timer. */\r
199                                                                         pdFALSE,                                                                /* Don't auto-reload - hence a one shot timer. */\r
200                                                                         ( void * ) 0,                                                   /* The timer identifier.  In this case this is not used as the timer has its own callback. */\r
201                                                                         prvOneShotTimerCallback );                              /* The callback to be called when the timer expires. */\r
202 \r
203         if( xOneShotTimer == NULL )\r
204         {\r
205                 xTestStatus = pdFAIL;\r
206                 configASSERT( xTestStatus );\r
207         }\r
208 \r
209 \r
210         /* Ensure all the timers are in their expected initial state.  This\r
211         depends on the timer service task having a higher priority than this task. */\r
212         prvTest2_CheckTaskAndTimersInitialState();\r
213 \r
214         for( ;; )\r
215         {\r
216                 /* Check the auto reload timers expire at the expected/correct rates. */\r
217                 prvTest3_CheckAutoReloadExpireRates();\r
218 \r
219                 /* Check the auto reload timers can be stopped correctly, and correctly\r
220                 report their state. */\r
221                 prvTest4_CheckAutoReloadTimersCanBeStopped();\r
222                                 \r
223                 /* Check the one shot timer only calls its callback once after it has been\r
224                 started, and that it reports its state correctly. */\r
225                 prvTest5_CheckBasicOneShotTimerBehaviour();\r
226 \r
227                 /* Check timer reset behaviour. */\r
228                 prvTest6_CheckAutoReloadResetBehaviour();\r
229 \r
230                 /* Start the timers again to restart all the tests over again. */\r
231                 prvResetStartConditionsForNextIteration();\r
232         }\r
233 }\r
234 /*-----------------------------------------------------------*/\r
235 \r
236 /* This is called to check that the created task is still running and has not\r
237 detected any errors. */\r
238 portBASE_TYPE xAreTimerDemoTasksStillRunning( portTickType xCycleFrequency )\r
239 {\r
240 static unsigned long ulLastLoopCounter = 0UL;\r
241 portTickType xMaxBlockTimeUsedByTheseTests, xLoopCounterIncrementTimeMax;\r
242 static portTickType xIterationsWithoutCounterIncrement = ( portTickType ) 0, xLastCycleFrequency;\r
243 \r
244         if( xLastCycleFrequency != xCycleFrequency )\r
245         {\r
246                 /* The cycle frequency has probably become much faster due to an error\r
247                 elsewhere.  Start counting Iterations again. */\r
248                 xIterationsWithoutCounterIncrement = ( portTickType ) 0;\r
249                 xLastCycleFrequency = xCycleFrequency;\r
250         }               \r
251 \r
252         /* Calculate the maximum number of times that it is permissible for this\r
253         function to be called without ulLoopCounter being incremented.  This is\r
254         necessary because the tests in this file block for extended periods, and the\r
255         block period might be longer than the time between calls to this function. */\r
256         xMaxBlockTimeUsedByTheseTests = ( ( portTickType ) configTIMER_QUEUE_LENGTH ) * xBasePeriod;\r
257         xLoopCounterIncrementTimeMax = xMaxBlockTimeUsedByTheseTests / xCycleFrequency;\r
258 \r
259         /* If the demo task is still running then we expect the loopcounter to\r
260         have incremented every xLoopCounterIncrementTimeMax calls. */\r
261         if( ulLastLoopCounter == ulLoopCounter )\r
262         {\r
263                 xIterationsWithoutCounterIncrement++;\r
264                 if( xIterationsWithoutCounterIncrement > xLoopCounterIncrementTimeMax )\r
265                 {\r
266                         /* The tests appear to be no longer running (stalled). */\r
267                         xTestStatus = pdFAIL;\r
268                         configASSERT( xTestStatus );\r
269                 }\r
270         }\r
271         else\r
272         {\r
273                 /* ulLoopCounter changed, so the count of times this function was called\r
274                 without a change can be reset to zero. */\r
275                 xIterationsWithoutCounterIncrement = ( portTickType ) 0;\r
276         }\r
277 \r
278         ulLastLoopCounter = ulLoopCounter;\r
279 \r
280         /* Errors detected in the task itself will have latched xTestStatus\r
281         to pdFAIL. */\r
282 \r
283         return xTestStatus;\r
284 }\r
285 /*-----------------------------------------------------------*/\r
286 \r
287 static void prvTest1_CreateTimersWithoutSchedulerRunning( void )\r
288 {\r
289 unsigned portBASE_TYPE xTimer;\r
290 \r
291         for( xTimer = 0; xTimer < configTIMER_QUEUE_LENGTH; xTimer++ )\r
292         {\r
293                 /* As the timer queue is not yet full, it should be possible to both create\r
294                 and start a timer.  These timers are being started before the scheduler has\r
295                 been started, so their block times should get set to zero within the timer\r
296                 API itself. */\r
297                 xAutoReloadTimers[ xTimer ] = xTimerCreate( ( const signed char * )"FR Timer",  /* Text name to facilitate debugging.  The kernel does not use this itself. */\r
298                                                                                                         ( ( xTimer + ( portTickType ) 1 ) * xBasePeriod ),/* The period for the timer.  The plus 1 ensures a period of zero is not specified. */\r
299                                                                                                         pdTRUE,                                                         /* Auto-reload is set to true. */\r
300                                                                                                         ( void * ) xTimer,                                      /* An identifier for the timer as all the auto reload timers use the same callback. */\r
301                                                                                                         prvAutoReloadTimerCallback );           /* The callback to be called when the timer expires. */\r
302 \r
303                 if( xAutoReloadTimers[ xTimer ] == NULL )\r
304                 {\r
305                         xTestStatus = pdFAIL;\r
306                         configASSERT( xTestStatus );\r
307                 }\r
308                 else\r
309                 {\r
310                         /* The scheduler has not yet started, so the block period of\r
311                         portMAX_DELAY should just get set to zero in xTimerStart().  Also,\r
312                         the timer queue is not yet full so xTimerStart() should return\r
313                         pdPASS. */\r
314                         if( xTimerStart( xAutoReloadTimers[ xTimer ], portMAX_DELAY ) != pdPASS )\r
315                         {\r
316                                 xTestStatus = pdFAIL;\r
317                                 configASSERT( xTestStatus );\r
318                         }\r
319                 }\r
320         }\r
321 \r
322         /* The timers queue should now be full, so it should be possible to create\r
323         another timer, but not possible to start it (the timer queue will not get\r
324         drained until the scheduler has been started. */\r
325         xAutoReloadTimers[ configTIMER_QUEUE_LENGTH ] = xTimerCreate( ( const signed char * ) "FR Timer",       /* Text name to facilitate debugging.  The kernel does not use this itself. */\r
326                                                                                                         ( configTIMER_QUEUE_LENGTH * xBasePeriod ),                     /* The period for the timer. */\r
327                                                                                                         pdTRUE,                                                                                         /* Auto-reload is set to true. */\r
328                                                                                                         ( void * ) xTimer,                                                                      /* An identifier for the timer as all the auto reload timers use the same callback. */\r
329                                                                                                         prvAutoReloadTimerCallback );                                           /* The callback executed when the timer expires. */\r
330 \r
331         if( xAutoReloadTimers[ configTIMER_QUEUE_LENGTH ] == NULL )\r
332         {\r
333                 xTestStatus = pdFAIL;\r
334                 configASSERT( xTestStatus );\r
335         }\r
336         else\r
337         {\r
338                 if( xTimerStart( xAutoReloadTimers[ xTimer ], portMAX_DELAY ) == pdPASS )\r
339                 {\r
340                         /* This time it would not be expected that the timer could be\r
341                         started at this point. */\r
342                         xTestStatus = pdFAIL;\r
343                         configASSERT( xTestStatus );\r
344                 }\r
345         }\r
346         \r
347         /* Create the timers that are used from the tick interrupt to test the timer\r
348         API functions that can be called from an ISR. */\r
349         xISRAutoReloadTimer = xTimerCreate( ( const signed char * ) "ISR AR",   /* The text name given to the timer. */\r
350                                                                                 0xffff,                                                         /* The timer is not given a period yet - this will be done from the tick hook, but a period of 0 is invalid. */\r
351                                                                                 pdTRUE,                                                         /* This is an auto reload timer. */\r
352                                                                                 ( void * ) NULL,                                        /* The identifier is not required. */\r
353                                                                                 prvISRAutoReloadTimerCallback );        /* The callback that is executed when the timer expires. */\r
354 \r
355         xISROneShotTimer = xTimerCreate(        ( const signed char * ) "ISR OS",       /* The text name given to the timer. */\r
356                                                                                 0xffff,                                                         /* The timer is not given a period yet - this will be done from the tick hook, but a period of 0 is invalid. */\r
357                                                                                 pdFALSE,                                                        /* This is a one shot timer. */\r
358                                                                                 ( void * ) NULL,                                        /* The identifier is not required. */\r
359                                                                                 prvISROneShotTimerCallback );           /* The callback that is executed when the timer expires. */\r
360                                                                                 \r
361         if( ( xISRAutoReloadTimer == NULL ) || ( xISROneShotTimer == NULL ) )\r
362         {\r
363                 xTestStatus = pdFAIL;\r
364                 configASSERT( xTestStatus );\r
365         }\r
366 }\r
367 /*-----------------------------------------------------------*/\r
368 \r
369 static void prvTest2_CheckTaskAndTimersInitialState( void )\r
370 {\r
371 unsigned char ucTimer;\r
372 \r
373         /* Ensure all the timers are in their expected initial state.  This     depends\r
374         on the timer service task having a higher priority than this task.\r
375 \r
376         auto reload timers 0 to ( configTIMER_QUEUE_LENGTH - 1 ) should now be active,\r
377         and auto reload timer configTIMER_QUEUE_LENGTH should not yet be active (it\r
378         could not be started prior to the scheduler being started when it was\r
379         created). */\r
380         for( ucTimer = 0; ucTimer < ( unsigned char ) configTIMER_QUEUE_LENGTH; ucTimer++ )\r
381         {\r
382                 if( xTimerIsTimerActive( xAutoReloadTimers[ ucTimer ] ) == pdFALSE )\r
383                 {\r
384                         xTestStatus = pdFAIL;\r
385                         configASSERT( xTestStatus );\r
386                 }\r
387         }\r
388 \r
389         if( xTimerIsTimerActive( xAutoReloadTimers[ configTIMER_QUEUE_LENGTH ] ) != pdFALSE )\r
390         {\r
391                 xTestStatus = pdFAIL;\r
392                 configASSERT( xTestStatus );\r
393         }\r
394 }\r
395 /*-----------------------------------------------------------*/\r
396 \r
397 static void     prvTest3_CheckAutoReloadExpireRates( void )\r
398 {\r
399 unsigned char ucMaxAllowableValue, ucMinAllowableValue, ucTimer;\r
400 portTickType xBlockPeriod, xTimerPeriod, xExpectedNumber;\r
401 \r
402         /* Check the auto reload timers expire at the expected rates. */\r
403 \r
404         \r
405         /* Delaying for configTIMER_QUEUE_LENGTH * xBasePeriod ticks should allow\r
406         all the auto reload timers to expire at least once. */\r
407         xBlockPeriod = ( ( portTickType ) configTIMER_QUEUE_LENGTH ) * xBasePeriod;\r
408         vTaskDelay( xBlockPeriod );\r
409 \r
410         /* Check that all the auto reload timers have called their callback     \r
411         function the expected number of times. */\r
412         for( ucTimer = 0; ucTimer < ( unsigned char ) configTIMER_QUEUE_LENGTH; ucTimer++ )\r
413         {\r
414                 /* The expected number of expiries is equal to the block period divided\r
415                 by the timer period. */\r
416                 xTimerPeriod = ( ( ( portTickType ) ucTimer + ( portTickType ) 1 ) * xBasePeriod );\r
417                 xExpectedNumber = xBlockPeriod / xTimerPeriod;\r
418                 \r
419                 ucMaxAllowableValue = ( ( unsigned char ) xExpectedNumber ) ;\r
420                 ucMinAllowableValue = ( ( unsigned char ) xExpectedNumber - ( unsigned char ) 1 );\r
421 \r
422                 if( ( ucAutoReloadTimerCounters[ ucTimer ] < ucMinAllowableValue ) ||\r
423                         ( ucAutoReloadTimerCounters[ ucTimer ] > ucMaxAllowableValue )\r
424                         )\r
425                 {\r
426                         xTestStatus = pdFAIL;\r
427                         configASSERT( xTestStatus );\r
428                 }\r
429         }\r
430 \r
431         if( xTestStatus == pdPASS )\r
432         {\r
433                 /* No errors have been reported so increment the loop counter so the\r
434                 check task knows this task is still running. */\r
435                 ulLoopCounter++;\r
436         }\r
437 }\r
438 /*-----------------------------------------------------------*/\r
439 \r
440 static void prvTest4_CheckAutoReloadTimersCanBeStopped( void )\r
441 {               \r
442 unsigned char ucTimer;\r
443 \r
444         /* Check the auto reload timers can be stopped correctly, and correctly\r
445         report their state. */\r
446 \r
447         /* Stop all the active timers. */\r
448         for( ucTimer = 0; ucTimer < ( unsigned char ) configTIMER_QUEUE_LENGTH; ucTimer++ )\r
449         {\r
450                 /* The timer has not been stopped yet! */\r
451                 if( xTimerIsTimerActive( xAutoReloadTimers[ ucTimer ] ) == pdFALSE )\r
452                 {\r
453                         xTestStatus = pdFAIL;\r
454                         configASSERT( xTestStatus );\r
455                 }\r
456 \r
457                 /* Now stop the timer.  This will appear to happen immediately to\r
458                 this task because this task is running at a priority below the\r
459                 timer service task. */\r
460                 xTimerStop( xAutoReloadTimers[ ucTimer ], tmrdemoDONT_BLOCK );\r
461 \r
462                 /* The timer should now be inactive. */\r
463                 if( xTimerIsTimerActive( xAutoReloadTimers[ ucTimer ] ) != pdFALSE )\r
464                 {\r
465                         xTestStatus = pdFAIL;\r
466                         configASSERT( xTestStatus );\r
467                 }\r
468         }\r
469 \r
470         taskENTER_CRITICAL();\r
471         {\r
472                 /* The timer in array position configTIMER_QUEUE_LENGTH should not\r
473                 be active.  The critical section is used to ensure the timer does\r
474                 not call its callback between the next line running and the array\r
475                 being cleared back to zero, as that would mask an error condition. */\r
476                 if( ucAutoReloadTimerCounters[ configTIMER_QUEUE_LENGTH ] != ( unsigned char ) 0 )\r
477                 {\r
478                         xTestStatus = pdFAIL;\r
479                         configASSERT( xTestStatus );\r
480                 }\r
481 \r
482                 /* Clear the timer callback count. */\r
483                 memset( ( void * ) ucAutoReloadTimerCounters, 0, sizeof( ucAutoReloadTimerCounters ) );\r
484         }\r
485         taskEXIT_CRITICAL();\r
486 \r
487         /* The timers are now all inactive, so this time, after delaying, none\r
488         of the callback counters should have incremented. */\r
489         vTaskDelay( ( ( portTickType ) configTIMER_QUEUE_LENGTH ) * xBasePeriod );\r
490         for( ucTimer = 0; ucTimer < ( unsigned char ) configTIMER_QUEUE_LENGTH; ucTimer++ )\r
491         {\r
492                 if( ucAutoReloadTimerCounters[ ucTimer ] != ( unsigned char ) 0 )\r
493                 {\r
494                         xTestStatus = pdFAIL;\r
495                         configASSERT( xTestStatus );\r
496                 }\r
497         }\r
498 \r
499         if( xTestStatus == pdPASS )\r
500         {\r
501                 /* No errors have been reported so increment the loop counter so\r
502                 the check task knows this task is still running. */\r
503                 ulLoopCounter++;\r
504         }\r
505 }\r
506 /*-----------------------------------------------------------*/\r
507 \r
508 static void prvTest5_CheckBasicOneShotTimerBehaviour( void )\r
509 {\r
510         /* Check the one shot timer only calls its callback once after it has been\r
511         started, and that it reports its state correctly. */\r
512 \r
513         /* The one shot timer should not be active yet. */\r
514         if( xTimerIsTimerActive( xOneShotTimer ) != pdFALSE )\r
515         {\r
516                 xTestStatus = pdFAIL;\r
517                 configASSERT( xTestStatus );\r
518         }\r
519 \r
520         if( ucOneShotTimerCounter != ( unsigned char ) 0 )\r
521         {\r
522                 xTestStatus = pdFAIL;\r
523                 configASSERT( xTestStatus );\r
524         }\r
525 \r
526         /* Start the one shot timer and check that it reports its state correctly. */\r
527         xTimerStart( xOneShotTimer, tmrdemoDONT_BLOCK );\r
528         if( xTimerIsTimerActive( xOneShotTimer ) == pdFALSE )\r
529         {\r
530                 xTestStatus = pdFAIL;\r
531                 configASSERT( xTestStatus );\r
532         }\r
533 \r
534         /* Delay for three times as long as the one shot timer period, then check\r
535         to ensure it has only called its callback once, and is now not in the\r
536         active state. */\r
537         vTaskDelay( tmrdemoONE_SHOT_TIMER_PERIOD * ( portTickType ) 3 );\r
538 \r
539         if( xTimerIsTimerActive( xOneShotTimer ) != pdFALSE )\r
540         {\r
541                 xTestStatus = pdFAIL;\r
542                 configASSERT( xTestStatus );\r
543         }\r
544 \r
545         if( ucOneShotTimerCounter != ( unsigned char ) 1 )\r
546         {\r
547                 xTestStatus = pdFAIL;\r
548                 configASSERT( xTestStatus );\r
549         }\r
550         else\r
551         {\r
552                 /* Reset the one shot timer callback count. */\r
553                 ucOneShotTimerCounter = ( unsigned char ) 0;\r
554         }\r
555 \r
556         if( xTestStatus == pdPASS )\r
557         {\r
558                 /* No errors have been reported so increment the loop counter so the\r
559                 check task knows this task is still running. */\r
560                 ulLoopCounter++;\r
561         }\r
562 }\r
563 /*-----------------------------------------------------------*/\r
564 \r
565 static void prvTest6_CheckAutoReloadResetBehaviour( void )\r
566 {\r
567 unsigned char ucTimer;\r
568 \r
569         /* Check timer reset behaviour. */\r
570 \r
571         /* Restart the one shot timer and check it reports its status correctly. */\r
572         xTimerStart( xOneShotTimer, tmrdemoDONT_BLOCK );\r
573         if( xTimerIsTimerActive( xOneShotTimer ) == pdFALSE )\r
574         {\r
575                 xTestStatus = pdFAIL;\r
576                 configASSERT( xTestStatus );\r
577         }\r
578 \r
579         /* Restart one of the auto reload timers and check that it reports its\r
580         status correctly. */\r
581         xTimerStart( xAutoReloadTimers[ configTIMER_QUEUE_LENGTH - 1 ], tmrdemoDONT_BLOCK );\r
582         if( xTimerIsTimerActive( xAutoReloadTimers[ configTIMER_QUEUE_LENGTH - 1 ] ) == pdFALSE )\r
583         {\r
584                 xTestStatus = pdFAIL;\r
585                 configASSERT( xTestStatus );\r
586         }\r
587 \r
588         for( ucTimer = 0; ucTimer < trmdemoNUM_TIMER_RESETS; ucTimer++ )\r
589         {\r
590                 /* Delay for half as long as the one shot timer period, then reset it.\r
591                 It should never expire while this is done, so its callback count should\r
592                 never increment. */\r
593                 vTaskDelay( tmrdemoONE_SHOT_TIMER_PERIOD / 2 );\r
594 \r
595                 /* Check both running timers are still active, but have not called their\r
596                 callback functions. */\r
597                 if( xTimerIsTimerActive( xOneShotTimer ) == pdFALSE )\r
598                 {\r
599                         xTestStatus = pdFAIL;\r
600                         configASSERT( xTestStatus );\r
601                 }\r
602 \r
603                 if( ucOneShotTimerCounter != ( unsigned char ) 0 )\r
604                 {\r
605                         xTestStatus = pdFAIL;\r
606                         configASSERT( xTestStatus );\r
607                 }\r
608 \r
609                 if( xTimerIsTimerActive( xAutoReloadTimers[ configTIMER_QUEUE_LENGTH - 1 ] ) == pdFALSE )\r
610                 {\r
611                         xTestStatus = pdFAIL;\r
612                         configASSERT( xTestStatus );\r
613                 }\r
614 \r
615                 if( ucAutoReloadTimerCounters[ configTIMER_QUEUE_LENGTH - 1 ] != ( unsigned char ) 0 )\r
616                 {\r
617                         xTestStatus = pdFAIL;\r
618                         configASSERT( xTestStatus );\r
619                 }\r
620 \r
621                 /* Reset both running timers. */\r
622                 xTimerReset( xOneShotTimer, tmrdemoDONT_BLOCK );\r
623                 xTimerReset( xAutoReloadTimers[ configTIMER_QUEUE_LENGTH - 1 ], tmrdemoDONT_BLOCK );\r
624 \r
625                 if( xTestStatus == pdPASS )\r
626                 {\r
627                         /* No errors have been reported so increment the loop counter so\r
628                         the check task knows this task is still running. */\r
629                         ulLoopCounter++;\r
630                 }\r
631         }\r
632 \r
633         /* Finally delay long enough for both running timers to expire. */\r
634         vTaskDelay( ( ( portTickType ) configTIMER_QUEUE_LENGTH ) * xBasePeriod );\r
635 \r
636         /* The timers were not reset during the above delay period so should now\r
637         both have called their callback functions. */\r
638         if( ucOneShotTimerCounter != ( unsigned char ) 1 )\r
639         {\r
640                 xTestStatus = pdFAIL;\r
641                 configASSERT( xTestStatus );\r
642         }\r
643 \r
644         if( ucAutoReloadTimerCounters[ configTIMER_QUEUE_LENGTH - 1 ] == 0 )\r
645         {\r
646                 xTestStatus = pdFAIL;\r
647                 configASSERT( xTestStatus );\r
648         }\r
649 \r
650         /* The one shot timer should no longer be active, while the auto reload\r
651         timer should still be active. */\r
652         if( xTimerIsTimerActive( xAutoReloadTimers[ configTIMER_QUEUE_LENGTH - 1 ] ) == pdFALSE )\r
653         {\r
654                 xTestStatus = pdFAIL;\r
655                 configASSERT( xTestStatus );\r
656         }\r
657 \r
658         if( xTimerIsTimerActive( xOneShotTimer ) == pdTRUE )\r
659         {\r
660                 xTestStatus = pdFAIL;\r
661                 configASSERT( xTestStatus );\r
662         }\r
663 \r
664         /* Stop the auto reload timer again. */\r
665         xTimerStop( xAutoReloadTimers[ configTIMER_QUEUE_LENGTH - 1 ], tmrdemoDONT_BLOCK );\r
666 \r
667         if( xTimerIsTimerActive( xAutoReloadTimers[ configTIMER_QUEUE_LENGTH - 1 ] ) != pdFALSE )\r
668         {\r
669                 xTestStatus = pdFAIL;\r
670                 configASSERT( xTestStatus );\r
671         }\r
672 \r
673         /* Clear the timer callback counts, ready for another iteration of these\r
674         tests. */\r
675         ucAutoReloadTimerCounters[ configTIMER_QUEUE_LENGTH - 1 ] = ( unsigned char ) 0;\r
676         ucOneShotTimerCounter = ( unsigned char ) 0;\r
677 \r
678         if( xTestStatus == pdPASS )\r
679         {\r
680                 /* No errors have been reported so increment the loop counter so the check\r
681                 task knows this task is still running. */\r
682                 ulLoopCounter++;\r
683         }\r
684 }\r
685 /*-----------------------------------------------------------*/\r
686 \r
687 static void prvResetStartConditionsForNextIteration( void )\r
688 {\r
689 unsigned char ucTimer;\r
690 \r
691         /* Start the timers again to start all the tests over again. */\r
692 \r
693         /* Start the timers again. */\r
694         for( ucTimer = 0; ucTimer < ( unsigned char ) configTIMER_QUEUE_LENGTH; ucTimer++ )\r
695         {\r
696                 /* The timer has not been started yet! */\r
697                 if( xTimerIsTimerActive( xAutoReloadTimers[ ucTimer ] ) != pdFALSE )\r
698                 {\r
699                         xTestStatus = pdFAIL;\r
700                         configASSERT( xTestStatus );\r
701                 }\r
702 \r
703                 /* Now start the timer.  This will appear to happen immediately to\r
704                 this task because this task is running at a priority below the timer\r
705                 service task. */\r
706                 xTimerStart( xAutoReloadTimers[ ucTimer ], tmrdemoDONT_BLOCK );\r
707 \r
708                 /* The timer should now be active. */\r
709                 if( xTimerIsTimerActive( xAutoReloadTimers[ ucTimer ] ) == pdFALSE )\r
710                 {\r
711                         xTestStatus = pdFAIL;\r
712                         configASSERT( xTestStatus );\r
713                 }\r
714         }\r
715 \r
716         if( xTestStatus == pdPASS )\r
717         {\r
718                 /* No errors have been reported so increment the loop counter so the\r
719                 check task knows this task is still running. */\r
720                 ulLoopCounter++;\r
721         }\r
722 }\r
723 /*-----------------------------------------------------------*/\r
724 \r
725 void vTimerPeriodicISRTests( void )\r
726 {\r
727 static portTickType uxTick = ( portTickType ) -1;\r
728 \r
729 /* The xHigherPriorityTaskWoken parameter is not used in this case as this\r
730 function is called from the tick hook anyway.  However the API required it\r
731 to be present. */\r
732 signed portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;\r
733 portTickType xMargin;\r
734 \r
735         if( configTIMER_TASK_PRIORITY != ( configMAX_PRIORITIES - 1 ) )\r
736         {\r
737                 /* The timer service task is not the highest priority task, so it cannot\r
738                 be assumed that timings will be exact.  Timers should never call their\r
739                 callback before their expiry time, but a margin is permissible for calling\r
740                 their callback after their expiry time.  If exact timing is required then\r
741                 configTIMER_TASK_PRIORITY must be set to ensure the timer service task\r
742                 is the highest priority task in the system. */\r
743                 xMargin = 5;\r
744         }\r
745         else\r
746         {\r
747                 xMargin = 1;\r
748         }\r
749 \r
750         /* This test is called from the tick ISR even when the scheduler is suspended.\r
751         Therefore, it is possible for the xTickCount to be temporarily less than the\r
752         uxTicks count maintained in this function.  That can result in calculated\r
753         unblock times being too short, as this function is not called as missed ticks\r
754         (ticks that occur while the scheduler is suspended) are unwound to re-instate\r
755         the real tick value.  Therefore, if this happens, just abandon the test\r
756         and start again. */\r
757         if( xTaskGetSchedulerState() != taskSCHEDULER_RUNNING )\r
758         {\r
759                 uxTick = ( portTickType ) -1;\r
760         }\r
761         else\r
762         {\r
763                 uxTick++;\r
764         }\r
765 \r
766         if( uxTick == 0 )\r
767         {\r
768                 /* The timers will have been created, but not started.  Start them\r
769                 now by setting their period. */\r
770                 ucISRAutoReloadTimerCounter = 0;\r
771                 ucISROneShotTimerCounter = 0;\r
772                 xTimerChangePeriodFromISR( xISRAutoReloadTimer, xBasePeriod, &xHigherPriorityTaskWoken );\r
773                 xTimerChangePeriodFromISR( xISROneShotTimer, xBasePeriod, &xHigherPriorityTaskWoken );\r
774         }\r
775         else if( uxTick == xBasePeriod )\r
776         {\r
777                 /* Neither timer should have expired yet. */\r
778                 if( ( ucISRAutoReloadTimerCounter != 0 ) || ( ucISROneShotTimerCounter != 0 ) )\r
779                 {\r
780                         xTestStatus = pdFAIL;\r
781                         configASSERT( xTestStatus );\r
782                 }\r
783         }\r
784         else if( uxTick == ( xBasePeriod + xMargin ) )\r
785         {\r
786                 /* Both timers should now have expired once.  The auto reload timer will\r
787                 still be active, but the one shot timer should now have stopped. */\r
788                 if( ( ucISRAutoReloadTimerCounter != 1 ) || ( ucISROneShotTimerCounter != 1 ) )\r
789                 {\r
790                         xTestStatus = pdFAIL;\r
791                         configASSERT( xTestStatus );\r
792                 }\r
793         }\r
794         else if( uxTick == ( 2 * xBasePeriod ) )\r
795         {\r
796                 /* The auto reload timer will still be active, but the one shot timer\r
797                 should now have stopped - however, at this time neither of the timers\r
798                 should have expired again since the last test. */\r
799                 if( ( ucISRAutoReloadTimerCounter != 1 ) || ( ucISROneShotTimerCounter != 1 ) )\r
800                 {\r
801                         xTestStatus = pdFAIL;\r
802                         configASSERT( xTestStatus );\r
803                 }               \r
804         }\r
805         else if( uxTick == ( ( 2 * xBasePeriod ) + xMargin ) )\r
806         {\r
807                 /* The auto reload timer will still be active, but the one shot timer\r
808                 should now have stopped.  At this time the auto reload timer should have\r
809                 expired again, but the one shot timer count should not have changed. */\r
810                 if( ucISRAutoReloadTimerCounter != 2 )\r
811                 {\r
812                         xTestStatus = pdFAIL;\r
813                         configASSERT( xTestStatus );\r
814                 }\r
815                 \r
816                 if( ucISROneShotTimerCounter != 1 )\r
817                 {\r
818                         xTestStatus = pdFAIL;\r
819                         configASSERT( xTestStatus );\r
820                 }\r
821         }\r
822         else if( uxTick == ( ( 2 * xBasePeriod ) + ( xBasePeriod >> ( portTickType ) 2U ) ) )\r
823         {\r
824                 /* The auto reload timer will still be active, but the one shot timer\r
825                 should now have stopped.  Again though, at this time, neither timer call\r
826                 back should have been called since the last test. */\r
827                 if( ucISRAutoReloadTimerCounter != 2 )\r
828                 {\r
829                         xTestStatus = pdFAIL;\r
830                         configASSERT( xTestStatus );\r
831                 }\r
832                 \r
833                 if( ucISROneShotTimerCounter != 1 )\r
834                 {\r
835                         xTestStatus = pdFAIL;\r
836                         configASSERT( xTestStatus );\r
837                 }\r
838         }       \r
839         else if( uxTick == ( 3 * xBasePeriod ) )\r
840         {\r
841                 /* Start the one shot timer again. */\r
842                 xTimerStartFromISR( xISROneShotTimer, &xHigherPriorityTaskWoken );\r
843         }\r
844         else if( uxTick == ( ( 3 * xBasePeriod ) + xMargin ) )\r
845         {\r
846                 /* The auto reload timer and one shot timer will be active.  At\r
847                 this time the auto reload timer should have     expired again, but the one\r
848                 shot timer count should not have changed yet. */\r
849                 if( ucISRAutoReloadTimerCounter != 3 )\r
850                 {\r
851                         xTestStatus = pdFAIL;\r
852                         configASSERT( xTestStatus );\r
853                 }\r
854                 \r
855                 if( ucISROneShotTimerCounter != 1 )\r
856                 {\r
857                         xTestStatus = pdFAIL;\r
858                         configASSERT( xTestStatus );\r
859                 }\r
860                 \r
861                 /* Now stop the auto reload timer.  The one shot timer was started\r
862                 a few ticks ago. */\r
863                 xTimerStopFromISR( xISRAutoReloadTimer, &xHigherPriorityTaskWoken );\r
864         }       \r
865         else if( uxTick == ( 4 * xBasePeriod ) )\r
866         {\r
867                 /* The auto reload timer is now stopped, and the one shot timer is\r
868                 active, but at this time neither timer should have expired since the\r
869                 last test. */\r
870                 if( ucISRAutoReloadTimerCounter != 3 )\r
871                 {\r
872                         xTestStatus = pdFAIL;\r
873                         configASSERT( xTestStatus );\r
874                 }\r
875                 \r
876                 if( ucISROneShotTimerCounter != 1 )\r
877                 {\r
878                         xTestStatus = pdFAIL;\r
879                         configASSERT( xTestStatus );\r
880                 }\r
881         }       \r
882         else if( uxTick == ( ( 4 * xBasePeriod ) + xMargin ) )\r
883         {\r
884                 /* The auto reload timer is now stopped, and the one shot timer is\r
885                 active.  The one shot timer should have expired again, but the auto\r
886                 reload timer should not have executed its callback. */\r
887                 if( ucISRAutoReloadTimerCounter != 3 )\r
888                 {\r
889                         xTestStatus = pdFAIL;\r
890                         configASSERT( xTestStatus );\r
891                 }\r
892                 \r
893                 if( ucISROneShotTimerCounter != 2 )\r
894                 {\r
895                         xTestStatus = pdFAIL;\r
896                         configASSERT( xTestStatus );\r
897                 }\r
898         }       \r
899         else if( uxTick == ( ( 8 * xBasePeriod ) + xMargin ) )\r
900         {\r
901                 /* The auto reload timer is now stopped, and the one shot timer has\r
902                 already expired and then stopped itself.  Both callback counters should\r
903                 not have incremented since the last test. */\r
904                 if( ucISRAutoReloadTimerCounter != 3 )\r
905                 {\r
906                         xTestStatus = pdFAIL;\r
907                         configASSERT( xTestStatus );\r
908                 }\r
909                 \r
910                 if( ucISROneShotTimerCounter != 2 )\r
911                 {\r
912                         xTestStatus = pdFAIL;\r
913                         configASSERT( xTestStatus );\r
914                 }\r
915                 \r
916                 /* Now reset the one shot timer. */\r
917                 xTimerResetFromISR( xISROneShotTimer, &xHigherPriorityTaskWoken );\r
918         }       \r
919         else if( uxTick == ( 9 * xBasePeriod ) )\r
920         {\r
921                 /* Only the one shot timer should be running, but it should not have\r
922                 expired since the last test.  Check the callback counters have not\r
923                 incremented, then reset the one shot timer again. */\r
924                 if( ucISRAutoReloadTimerCounter != 3 )\r
925                 {\r
926                         xTestStatus = pdFAIL;\r
927                         configASSERT( xTestStatus );\r
928                 }\r
929                 \r
930                 if( ucISROneShotTimerCounter != 2 )\r
931                 {\r
932                         xTestStatus = pdFAIL;\r
933                         configASSERT( xTestStatus );\r
934                 }\r
935                 \r
936                 xTimerResetFromISR( xISROneShotTimer, &xHigherPriorityTaskWoken );\r
937         }       \r
938         else if( uxTick == ( 10 * xBasePeriod ) )\r
939         {\r
940                 /* Only the one shot timer should be running, but it should not have\r
941                 expired since the last test.  Check the callback counters have not\r
942                 incremented, then reset the one shot timer again. */\r
943                 if( ucISRAutoReloadTimerCounter != 3 )\r
944                 {\r
945                         xTestStatus = pdFAIL;\r
946                         configASSERT( xTestStatus );\r
947                 }\r
948                 \r
949                 if( ucISROneShotTimerCounter != 2 )\r
950                 {\r
951                         xTestStatus = pdFAIL;\r
952                         configASSERT( xTestStatus );\r
953                 }\r
954                 \r
955                 xTimerResetFromISR( xISROneShotTimer, &xHigherPriorityTaskWoken );\r
956         }\r
957         else if( uxTick == ( 11 * xBasePeriod ) )\r
958         {\r
959                 /* Only the one shot timer should be running, but it should not have\r
960                 expired since the last test.  Check the callback counters have not\r
961                 incremented, then reset the one shot timer once again. */\r
962                 if( ucISRAutoReloadTimerCounter != 3 )\r
963                 {\r
964                         xTestStatus = pdFAIL;\r
965                         configASSERT( xTestStatus );\r
966                 }\r
967                 \r
968                 if( ucISROneShotTimerCounter != 2 )\r
969                 {\r
970                         xTestStatus = pdFAIL;\r
971                         configASSERT( xTestStatus );\r
972                 }\r
973                 \r
974                 xTimerResetFromISR( xISROneShotTimer, &xHigherPriorityTaskWoken );\r
975         }       \r
976         else if( uxTick == ( ( 12 * xBasePeriod ) + xMargin ) )\r
977         {\r
978                 /* Only the one shot timer should have been running and this time it\r
979                 should have     expired.  Check its callback count has been incremented.\r
980                 The auto reload timer is still not running so should still have the same\r
981                 count value.  This time the one shot timer is not reset so should not\r
982                 restart from its expiry period again. */\r
983                 if( ucISRAutoReloadTimerCounter != 3 )\r
984                 {\r
985                         xTestStatus = pdFAIL;\r
986                         configASSERT( xTestStatus );\r
987                 }\r
988                 \r
989                 if( ucISROneShotTimerCounter != 3 )\r
990                 {\r
991                         xTestStatus = pdFAIL;\r
992                         configASSERT( xTestStatus );\r
993                 }\r
994         }\r
995         else if( uxTick == ( 15 * xBasePeriod ) )\r
996         {\r
997                 /* Neither timer should be running now.  Check neither callback count\r
998                 has incremented, then go back to the start to run these tests all\r
999                 over again. */\r
1000                 if( ucISRAutoReloadTimerCounter != 3 )\r
1001                 {\r
1002                         xTestStatus = pdFAIL;\r
1003                         configASSERT( xTestStatus );\r
1004                 }\r
1005                 \r
1006                 if( ucISROneShotTimerCounter != 3 )\r
1007                 {\r
1008                         xTestStatus = pdFAIL;\r
1009                         configASSERT( xTestStatus );\r
1010                 }\r
1011                 \r
1012                 uxTick = ( portTickType ) -1;\r
1013         }       \r
1014 }\r
1015 /*-----------------------------------------------------------*/\r
1016 \r
1017 /*** Timer callback functions are defined below here. ***/\r
1018 \r
1019 static void prvAutoReloadTimerCallback( xTimerHandle pxExpiredTimer )\r
1020 {\r
1021 unsigned long ulTimerID;\r
1022 \r
1023         ulTimerID = ( unsigned long ) pvTimerGetTimerID( pxExpiredTimer );\r
1024         if( ulTimerID <= ( configTIMER_QUEUE_LENGTH + 1 ) )\r
1025         {\r
1026                 ( ucAutoReloadTimerCounters[ ulTimerID ] )++;\r
1027         }\r
1028         else\r
1029         {\r
1030                 /* The timer ID appears to be unexpected (invalid). */\r
1031                 xTestStatus = pdFAIL;\r
1032                 configASSERT( xTestStatus );\r
1033         }\r
1034 }\r
1035 /*-----------------------------------------------------------*/\r
1036 \r
1037 static void prvOneShotTimerCallback( xTimerHandle pxExpiredTimer )\r
1038 {\r
1039         /* The parameter is not used in this case as only one timer uses this\r
1040         callback function. */\r
1041         ( void ) pxExpiredTimer;\r
1042 \r
1043         ucOneShotTimerCounter++;\r
1044 }\r
1045 /*-----------------------------------------------------------*/\r
1046 \r
1047 static void prvISRAutoReloadTimerCallback( xTimerHandle pxExpiredTimer )\r
1048 {\r
1049         /* The parameter is not used in this case as only one timer uses this\r
1050         callback function. */\r
1051         ( void ) pxExpiredTimer;\r
1052 \r
1053         ucISRAutoReloadTimerCounter++;\r
1054 }\r
1055 /*-----------------------------------------------------------*/\r
1056 \r
1057 static void prvISROneShotTimerCallback( xTimerHandle pxExpiredTimer )\r
1058 {\r
1059         /* The parameter is not used in this case as only one timer uses this\r
1060         callback function. */\r
1061         ( void ) pxExpiredTimer;\r
1062 \r
1063         ucISROneShotTimerCounter++;\r
1064 }\r
1065 /*-----------------------------------------------------------*/\r
1066 \r
1067 \r
1068 \r
1069 \r