]> git.sur5r.net Git - freertos/commitdiff
Update TimerDemo.c so it can be used with the CCS4 compiler without generating errors...
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sat, 12 Mar 2011 14:58:09 +0000 (14:58 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sat, 12 Mar 2011 14:58:09 +0000 (14:58 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1320 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Demo/Common/Minimal/TimerDemo.c

index 18b0381a9ae7d0ab5c23a6a0316c56d68295ffb9..1876665a042ecfe31394732576451f872e4326b4 100644 (file)
@@ -144,6 +144,11 @@ static portTickType xBasePeriod = 0;
 \r
 void vStartTimerDemoTask( portTickType xBasePeriodIn )\r
 {\r
+       /* Start with the timer and counter arrays clear - this is only necessary\r
+       where the compiler does not clear them automatically on start up. */\r
+       memset( ucAutoReloadTimerCounters, 0x00, sizeof( ucAutoReloadTimerCounters ) );\r
+       memset( xAutoReloadTimers, 0x00, sizeof( xAutoReloadTimers ) );\r
+\r
        /* Store the period from which all the timer periods will be generated from\r
        (multiples of). */\r
        xBasePeriod = xBasePeriodIn;\r
@@ -168,11 +173,11 @@ static void prvTimerTestTask( void *pvParameters )
        ( void ) pvParameters;\r
 \r
        /* Create a one-shot timer for use later on in this test. */\r
-       xOneShotTimer = xTimerCreate(   "Oneshot Timer",                                /* Text name to facilitate debugging.  The kernel does not use this itself. */\r
-                                                                       tmrdemoONE_SHOT_TIMER_PERIOD,   /* The period for the timer. */\r
-                                                                       pdFALSE,                                                /* Don't auto-reload - hence a one shot timer. */\r
-                                                                       ( void * ) 0,                                   /* The timer identifier.  In this case this is not used as the timer has its own callback. */\r
-                                                                       prvOneShotTimerCallback );              /* The callback to be called when the timer expires. */\r
+       xOneShotTimer = xTimerCreate(   ( const signed char * ) "Oneshot Timer",/* Text name to facilitate debugging.  The kernel does not use this itself. */\r
+                                                                       tmrdemoONE_SHOT_TIMER_PERIOD,                   /* The period for the timer. */\r
+                                                                       pdFALSE,                                                                /* Don't auto-reload - hence a one shot timer. */\r
+                                                                       ( void * ) 0,                                                   /* The timer identifier.  In this case this is not used as the timer has its own callback. */\r
+                                                                       prvOneShotTimerCallback );                              /* The callback to be called when the timer expires. */\r
 \r
        if( xOneShotTimer == NULL )\r
        {\r
@@ -268,7 +273,7 @@ unsigned portBASE_TYPE xTimer;
                and start a timer.  These timers are being started before the scheduler has\r
                been started, so their block times should get set to zero within the timer\r
                API itself. */\r
-               xAutoReloadTimers[ xTimer ] = xTimerCreate( "FR Timer",                                         /* Text name to facilitate debugging.  The kernel does not use this itself. */\r
+               xAutoReloadTimers[ xTimer ] = xTimerCreate( ( const signed char * )"FR Timer",  /* Text name to facilitate debugging.  The kernel does not use this itself. */\r
                                                                                                        ( ( xTimer + ( portTickType ) 1 ) * xBasePeriod ),/* The period for the timer.  The plus 1 ensures a period of zero is not specified. */\r
                                                                                                        pdTRUE,                                                         /* Auto-reload is set to true. */\r
                                                                                                        ( void * ) xTimer,                                      /* An identifier for the timer as all the auto reload timers use the same callback. */\r
@@ -296,11 +301,11 @@ unsigned portBASE_TYPE xTimer;
        /* The timers queue should now be full, so it should be possible to create\r
        another timer, but not possible to start it (the timer queue will not get\r
        drained until the scheduler has been started. */\r
-       xAutoReloadTimers[ configTIMER_QUEUE_LENGTH ] = xTimerCreate( "FR Timer",               /* Text name to facilitate debugging.  The kernel does not use this itself. */\r
-                                                                                                       ( configTIMER_QUEUE_LENGTH * xBasePeriod ),     /* The period for the timer. */\r
-                                                                                                       pdTRUE,                                                 /* Auto-reload is set to true. */\r
-                                                                                                       ( void * ) xTimer,                              /* An identifier for the timer as all the auto reload timers use the same callback. */\r
-                                                                                                       prvAutoReloadTimerCallback );   /* The callback executed when the timer expires. */\r
+       xAutoReloadTimers[ configTIMER_QUEUE_LENGTH ] = xTimerCreate( ( const signed char * ) "FR Timer",       /* Text name to facilitate debugging.  The kernel does not use this itself. */\r
+                                                                                                       ( configTIMER_QUEUE_LENGTH * xBasePeriod ),                     /* The period for the timer. */\r
+                                                                                                       pdTRUE,                                                                                         /* Auto-reload is set to true. */\r
+                                                                                                       ( void * ) xTimer,                                                                      /* An identifier for the timer as all the auto reload timers use the same callback. */\r
+                                                                                                       prvAutoReloadTimerCallback );                                           /* The callback executed when the timer expires. */\r
 \r
        if( xAutoReloadTimers[ configTIMER_QUEUE_LENGTH ] == NULL )\r
        {\r
@@ -320,17 +325,17 @@ unsigned portBASE_TYPE xTimer;
        \r
        /* Create the timers that are used from the tick interrupt to test the timer\r
        API functions that can be called from an ISR. */\r
-       xISRAutoReloadTimer = xTimerCreate( "ISR AR",                                           /* The text name given to the timer. */\r
-                                                                               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
-                                                                               pdTRUE,                                                 /* This is an auto reload timer. */\r
-                                                                               ( void * ) NULL,                                /* The identifier is not required. */\r
-                                                                               prvISRAutoReloadTimerCallback );/* The callback that is executed when the timer expires. */\r
-\r
-       xISROneShotTimer = xTimerCreate(        "ISR OS",                                               /* The text name given to the timer. */\r
-                                                                               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
-                                                                               pdFALSE,                                                /* This is a one shot timer. */\r
-                                                                               ( void * ) NULL,                                /* The identifier is not required. */\r
-                                                                               prvISROneShotTimerCallback );   /* The callback that is executed when the timer expires. */\r
+       xISRAutoReloadTimer = xTimerCreate( ( const signed char * ) "ISR AR",   /* The text name given to the timer. */\r
+                                                                               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
+                                                                               pdTRUE,                                                         /* This is an auto reload timer. */\r
+                                                                               ( void * ) NULL,                                        /* The identifier is not required. */\r
+                                                                               prvISRAutoReloadTimerCallback );        /* The callback that is executed when the timer expires. */\r
+\r
+       xISROneShotTimer = xTimerCreate(        ( const signed char * ) "ISR OS",       /* The text name given to the timer. */\r
+                                                                               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
+                                                                               pdFALSE,                                                        /* This is a one shot timer. */\r
+                                                                               ( void * ) NULL,                                        /* The identifier is not required. */\r
+                                                                               prvISROneShotTimerCallback );           /* The callback that is executed when the timer expires. */\r
                                                                                \r
        if( ( xISRAutoReloadTimer == NULL ) || ( xISROneShotTimer == NULL ) )\r
        {\r