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