From: richardbarry Date: Sat, 12 Mar 2011 14:58:09 +0000 (+0000) Subject: Update TimerDemo.c so it can be used with the CCS4 compiler without generating errors... X-Git-Tag: V7.0.0~29 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e474adfa921f26ee2ff8420d116134693344eada;p=freertos Update TimerDemo.c so it can be used with the CCS4 compiler without generating errors or warnings. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1320 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/Demo/Common/Minimal/TimerDemo.c b/Demo/Common/Minimal/TimerDemo.c index 18b0381a9..1876665a0 100644 --- a/Demo/Common/Minimal/TimerDemo.c +++ b/Demo/Common/Minimal/TimerDemo.c @@ -144,6 +144,11 @@ static portTickType xBasePeriod = 0; void vStartTimerDemoTask( portTickType xBasePeriodIn ) { + /* Start with the timer and counter arrays clear - this is only necessary + where the compiler does not clear them automatically on start up. */ + memset( ucAutoReloadTimerCounters, 0x00, sizeof( ucAutoReloadTimerCounters ) ); + memset( xAutoReloadTimers, 0x00, sizeof( xAutoReloadTimers ) ); + /* Store the period from which all the timer periods will be generated from (multiples of). */ xBasePeriod = xBasePeriodIn; @@ -168,11 +173,11 @@ static void prvTimerTestTask( void *pvParameters ) ( void ) pvParameters; /* Create a one-shot timer for use later on in this test. */ - xOneShotTimer = xTimerCreate( "Oneshot Timer", /* Text name to facilitate debugging. The kernel does not use this itself. */ - tmrdemoONE_SHOT_TIMER_PERIOD, /* The period for the timer. */ - pdFALSE, /* Don't auto-reload - hence a one shot timer. */ - ( void * ) 0, /* The timer identifier. In this case this is not used as the timer has its own callback. */ - prvOneShotTimerCallback ); /* The callback to be called when the timer expires. */ + xOneShotTimer = xTimerCreate( ( const signed char * ) "Oneshot Timer",/* Text name to facilitate debugging. The kernel does not use this itself. */ + tmrdemoONE_SHOT_TIMER_PERIOD, /* The period for the timer. */ + pdFALSE, /* Don't auto-reload - hence a one shot timer. */ + ( void * ) 0, /* The timer identifier. In this case this is not used as the timer has its own callback. */ + prvOneShotTimerCallback ); /* The callback to be called when the timer expires. */ if( xOneShotTimer == NULL ) { @@ -268,7 +273,7 @@ unsigned portBASE_TYPE xTimer; and start a timer. These timers are being started before the scheduler has been started, so their block times should get set to zero within the timer API itself. */ - xAutoReloadTimers[ xTimer ] = xTimerCreate( "FR Timer", /* Text name to facilitate debugging. The kernel does not use this itself. */ + xAutoReloadTimers[ xTimer ] = xTimerCreate( ( const signed char * )"FR Timer", /* Text name to facilitate debugging. The kernel does not use this itself. */ ( ( xTimer + ( portTickType ) 1 ) * xBasePeriod ),/* The period for the timer. The plus 1 ensures a period of zero is not specified. */ pdTRUE, /* Auto-reload is set to true. */ ( void * ) xTimer, /* An identifier for the timer as all the auto reload timers use the same callback. */ @@ -296,11 +301,11 @@ unsigned portBASE_TYPE xTimer; /* The timers queue should now be full, so it should be possible to create another timer, but not possible to start it (the timer queue will not get drained until the scheduler has been started. */ - xAutoReloadTimers[ configTIMER_QUEUE_LENGTH ] = xTimerCreate( "FR Timer", /* Text name to facilitate debugging. The kernel does not use this itself. */ - ( configTIMER_QUEUE_LENGTH * xBasePeriod ), /* The period for the timer. */ - pdTRUE, /* Auto-reload is set to true. */ - ( void * ) xTimer, /* An identifier for the timer as all the auto reload timers use the same callback. */ - prvAutoReloadTimerCallback ); /* The callback executed when the timer expires. */ + xAutoReloadTimers[ configTIMER_QUEUE_LENGTH ] = xTimerCreate( ( const signed char * ) "FR Timer", /* Text name to facilitate debugging. The kernel does not use this itself. */ + ( configTIMER_QUEUE_LENGTH * xBasePeriod ), /* The period for the timer. */ + pdTRUE, /* Auto-reload is set to true. */ + ( void * ) xTimer, /* An identifier for the timer as all the auto reload timers use the same callback. */ + prvAutoReloadTimerCallback ); /* The callback executed when the timer expires. */ if( xAutoReloadTimers[ configTIMER_QUEUE_LENGTH ] == NULL ) { @@ -320,17 +325,17 @@ unsigned portBASE_TYPE xTimer; /* Create the timers that are used from the tick interrupt to test the timer API functions that can be called from an ISR. */ - xISRAutoReloadTimer = xTimerCreate( "ISR AR", /* The text name given to the timer. */ - 0xffff, /* The timer is not given a period yet - this will be done from the tick hook, but a period of 0 is invalid. */ - pdTRUE, /* This is an auto reload timer. */ - ( void * ) NULL, /* The identifier is not required. */ - prvISRAutoReloadTimerCallback );/* The callback that is executed when the timer expires. */ - - xISROneShotTimer = xTimerCreate( "ISR OS", /* The text name given to the timer. */ - 0xffff, /* The timer is not given a period yet - this will be done from the tick hook, but a period of 0 is invalid. */ - pdFALSE, /* This is a one shot timer. */ - ( void * ) NULL, /* The identifier is not required. */ - prvISROneShotTimerCallback ); /* The callback that is executed when the timer expires. */ + xISRAutoReloadTimer = xTimerCreate( ( const signed char * ) "ISR AR", /* The text name given to the timer. */ + 0xffff, /* The timer is not given a period yet - this will be done from the tick hook, but a period of 0 is invalid. */ + pdTRUE, /* This is an auto reload timer. */ + ( void * ) NULL, /* The identifier is not required. */ + prvISRAutoReloadTimerCallback ); /* The callback that is executed when the timer expires. */ + + xISROneShotTimer = xTimerCreate( ( const signed char * ) "ISR OS", /* The text name given to the timer. */ + 0xffff, /* The timer is not given a period yet - this will be done from the tick hook, but a period of 0 is invalid. */ + pdFALSE, /* This is a one shot timer. */ + ( void * ) NULL, /* The identifier is not required. */ + prvISROneShotTimerCallback ); /* The callback that is executed when the timer expires. */ if( ( xISRAutoReloadTimer == NULL ) || ( xISROneShotTimer == NULL ) ) {