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