@ -144,6 +144,11 @@ static portTickType xBasePeriod = 0;
void vStartTimerDemoTask ( portTickType xBasePeriodIn )
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
/* Store the period from which all the timer periods will be generated from
( multiples of ) . */
( multiples of ) . */
xBasePeriod = xBasePeriodIn ;
xBasePeriod = xBasePeriodIn ;
@ -168,11 +173,11 @@ static void prvTimerTestTask( void *pvParameters )
( void ) pvParameters ;
( void ) pvParameters ;
/* Create a one-shot timer for use later on in this test. */
/* 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. */
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. */
tmrdemoONE_SHOT_TIMER_PERIOD , /* The period for the timer. */
pdFALSE , /* Don't auto-reload - hence a one shot 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. */
( 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. */
prvOneShotTimerCallback ) ; /* The callback to be called when the timer expires. */
if ( xOneShotTimer = = NULL )
if ( xOneShotTimer = = NULL )
{
{
@ -268,7 +273,7 @@ unsigned portBASE_TYPE xTimer;
and start a timer . These timers are being started before the scheduler has
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
been started , so their block times should get set to zero within the timer
API itself . */
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. */
( ( 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. */
pdTRUE , /* Auto-reload is set to true. */
( void * ) xTimer , /* An identifier for the timer as all the auto reload timers use the same callback. */
( 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
/* 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
another timer , but not possible to start it ( the timer queue will not get
drained until the scheduler has been started . */
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. */
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. */
( configTIMER_QUEUE_LENGTH * xBasePeriod ) , /* The period for the timer. */
pdTRUE , /* Auto-reload is set to true. */
pdTRUE , /* Auto-reload is set to true. */
( void * ) xTimer , /* An identifier for the timer as all the auto reload timers use the same callback. */
( 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. */
prvAutoReloadTimerCallback ) ; /* The callback executed when the timer expires. */
if ( xAutoReloadTimers [ configTIMER_QUEUE_LENGTH ] = = NULL )
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
/* Create the timers that are used from the tick interrupt to test the timer
API functions that can be called from an ISR . */
API functions that can be called from an ISR . */
xISRAutoReloadTimer = xTimerCreate ( " ISR AR " , /* The text name given to the timer. */
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. */
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. */
pdTRUE , /* This is an auto reload timer. */
( void * ) NULL , /* The identifier is not required. */
( void * ) NULL , /* The identifier is not required. */
prvISRAutoReloadTimerCallback ) ; /* The callback that is executed when the timer expires. */
prvISRAutoReloadTimerCallback ) ; /* The callback that is executed when the timer expires. */
xISROneShotTimer = xTimerCreate ( " ISR OS " , /* The text name given to the timer. */
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. */
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. */
pdFALSE , /* This is a one shot timer. */
( void * ) NULL , /* The identifier is not required. */
( void * ) NULL , /* The identifier is not required. */
prvISROneShotTimerCallback ) ; /* The callback that is executed when the timer expires. */
prvISROneShotTimerCallback ) ; /* The callback that is executed when the timer expires. */
if ( ( xISRAutoReloadTimer = = NULL ) | | ( xISROneShotTimer = = NULL ) )
if ( ( xISRAutoReloadTimer = = NULL ) | | ( xISROneShotTimer = = NULL ) )
{
{