\r
static void prvTest1_CreateTimersWithoutSchedulerRunning( void )\r
{\r
-portBASE_TYPE xTimer;\r
+unsigned portBASE_TYPE xTimer;\r
\r
for( xTimer = 0; xTimer < configTIMER_QUEUE_LENGTH; xTimer++ )\r
{\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
- ( ( xTimer + 1 ) * xBasePeriod ),/* The period for the timer. The plus 1 ensures a period of zero is not specified. */\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
prvAutoReloadTimerCallback ); /* The callback to be called when the timer expires. */\r
/* This time it would not be expected that the timer could be\r
started at this point. */\r
xTestStatus = pdFAIL;\r
- configASSERT( xTestStatus );\r
+ configASSERT( xTestStatus );\r
}\r
}\r
\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
- 0, /* The timer is not given a period yet - this will be done from the tick hook. */\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
- 0, /* The timer is not given a period yet - this will be done from the tick hook. */\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
void vTimerPeriodicISRTests( void )\r
{\r
-static unsigned portBASE_TYPE uxTick = ( unsigned portBASE_TYPE ) -1;\r
+static portTickType uxTick = ( portTickType ) -1;\r
\r
/* The xHigherPriorityTaskWoken parameter is not used in this case as this\r
function is called from the tick hook anyway. However the API required it\r
to be present. */\r
portBASE_TYPE xHigherPriorityTaskWoken = pdTRUE;\r
-portBASE_TYPE xMargin;\r
+portTickType xMargin;\r
\r
if( configTIMER_TASK_PRIORITY != ( configMAX_PRIORITIES - 1 ) )\r
{\r
}\r
else\r
{\r
- xMargin = 0;\r
+ xMargin = 1;\r
+ }\r
+\r
+ /* This test is called from the tick ISR even when the scheduler is suspended.\r
+ Therefore, it is possible for the xTickCount to be temporarily less than the\r
+ uxTicks count maintained in this function. That can result in calculated\r
+ unblock times being too short, as this function is not called as missed ticks\r
+ (ticks that occur while the scheduler is suspended) are unwound to re-instate\r
+ the real tick value. Therefore, if this happens, just abandon the test\r
+ and start again. */\r
+ if( xTaskGetSchedulerState() != taskSCHEDULER_RUNNING )\r
+ {\r
+ uxTick = ( portTickType ) -1;\r
+ }\r
+ else\r
+ {\r
+ uxTick++;\r
}\r
- \r
- uxTick++;\r
\r
if( uxTick == 0 )\r
{\r
configASSERT( xTestStatus );\r
}\r
\r
- uxTick = ( unsigned portBASE_TYPE ) -1;\r
+ uxTick = ( portTickType ) -1;\r
} \r
}\r
/*-----------------------------------------------------------*/\r