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