\r
#define tmrdemoDONT_BLOCK ( ( TickType_t ) 0 )\r
#define tmrdemoONE_SHOT_TIMER_PERIOD ( xBasePeriod * ( TickType_t ) 3 )\r
-#define trmdemoNUM_TIMER_RESETS ( ( unsigned char ) 10 )\r
+#define trmdemoNUM_TIMER_RESETS ( ( uint8_t ) 10 )\r
\r
/*-----------------------------------------------------------*/\r
\r
\r
/* Flag that will be latched to pdFAIL should any unexpected behaviour be\r
detected in any of the demo tests. */\r
-static volatile portBASE_TYPE xTestStatus = pdPASS;\r
+static volatile BaseType_t xTestStatus = pdPASS;\r
\r
/* Counter that is incremented on each cycle of a test. This is used to\r
detect a stalled task - a test that is no longer running. */\r
-static volatile unsigned long ulLoopCounter = 0;\r
+static volatile uint32_t ulLoopCounter = 0;\r
\r
/* A set of auto reload timers - each of which use the same callback function.\r
The callback function uses the timer ID to index into, and then increment, a\r
counter in the ucAutoReloadTimerCounters[] array. The auto reload timers\r
referenced from xAutoReloadTimers[] are used by the prvTimerTestTask task. */\r
static TimerHandle_t xAutoReloadTimers[ configTIMER_QUEUE_LENGTH + 1 ] = { 0 };\r
-static unsigned char ucAutoReloadTimerCounters[ configTIMER_QUEUE_LENGTH + 1 ] = { 0 };\r
+static uint8_t ucAutoReloadTimerCounters[ configTIMER_QUEUE_LENGTH + 1 ] = { 0 };\r
\r
/* The one shot timer is configured to use a callback function that increments\r
ucOneShotTimerCounter each time it gets called. */\r
static TimerHandle_t xOneShotTimer = NULL;\r
-static unsigned char ucOneShotTimerCounter = ( unsigned char ) 0;\r
+static uint8_t ucOneShotTimerCounter = ( uint8_t ) 0;\r
\r
/* The ISR reload timer is controlled from the tick hook to exercise the timer\r
API functions that can be used from an ISR. It is configured to increment\r
ucISRReloadTimerCounter each time its callback function is executed. */\r
static TimerHandle_t xISRAutoReloadTimer = NULL;\r
-static unsigned char ucISRAutoReloadTimerCounter = ( unsigned char ) 0;\r
+static uint8_t ucISRAutoReloadTimerCounter = ( uint8_t ) 0;\r
\r
/* The ISR one shot timer is controlled from the tick hook to exercise the timer\r
API functions that can be used from an ISR. It is configured to increment\r
ucISRReloadTimerCounter each time its callback function is executed. */\r
static TimerHandle_t xISROneShotTimer = NULL;\r
-static unsigned char ucISROneShotTimerCounter = ( unsigned char ) 0;\r
+static uint8_t ucISROneShotTimerCounter = ( uint8_t ) 0;\r
\r
/* The period of all the timers are a multiple of the base period. The base\r
period is configured by the parameter to vStartTimerDemoTask(). */\r
\r
/* This is called to check that the created task is still running and has not\r
detected any errors. */\r
-portBASE_TYPE xAreTimerDemoTasksStillRunning( TickType_t xCycleFrequency )\r
+BaseType_t xAreTimerDemoTasksStillRunning( TickType_t xCycleFrequency )\r
{\r
-static unsigned long ulLastLoopCounter = 0UL;\r
+static uint32_t ulLastLoopCounter = 0UL;\r
TickType_t xMaxBlockTimeUsedByTheseTests, xLoopCounterIncrementTimeMax;\r
static TickType_t xIterationsWithoutCounterIncrement = ( TickType_t ) 0, xLastCycleFrequency;\r
\r
\r
static void prvTest1_CreateTimersWithoutSchedulerRunning( void )\r
{\r
-unsigned portBASE_TYPE xTimer;\r
+UBaseType_t xTimer;\r
\r
for( xTimer = 0; xTimer < configTIMER_QUEUE_LENGTH; xTimer++ )\r
{\r
\r
static void prvTest2_CheckTaskAndTimersInitialState( void )\r
{\r
-unsigned char ucTimer;\r
+uint8_t ucTimer;\r
\r
/* Ensure all the timers are in their expected initial state. This depends\r
on the timer service task having a higher priority than this task.\r
and auto reload timer configTIMER_QUEUE_LENGTH should not yet be active (it\r
could not be started prior to the scheduler being started when it was\r
created). */\r
- for( ucTimer = 0; ucTimer < ( unsigned char ) configTIMER_QUEUE_LENGTH; ucTimer++ )\r
+ for( ucTimer = 0; ucTimer < ( uint8_t ) configTIMER_QUEUE_LENGTH; ucTimer++ )\r
{\r
if( xTimerIsTimerActive( xAutoReloadTimers[ ucTimer ] ) == pdFALSE )\r
{\r
\r
static void prvTest3_CheckAutoReloadExpireRates( void )\r
{\r
-unsigned char ucMaxAllowableValue, ucMinAllowableValue, ucTimer;\r
+uint8_t ucMaxAllowableValue, ucMinAllowableValue, ucTimer;\r
TickType_t xBlockPeriod, xTimerPeriod, xExpectedNumber;\r
\r
/* Check the auto reload timers expire at the expected rates. */\r
\r
/* Check that all the auto reload timers have called their callback \r
function the expected number of times. */\r
- for( ucTimer = 0; ucTimer < ( unsigned char ) configTIMER_QUEUE_LENGTH; ucTimer++ )\r
+ for( ucTimer = 0; ucTimer < ( uint8_t ) configTIMER_QUEUE_LENGTH; ucTimer++ )\r
{\r
/* The expected number of expiries is equal to the block period divided\r
by the timer period. */\r
xTimerPeriod = ( ( ( TickType_t ) ucTimer + ( TickType_t ) 1 ) * xBasePeriod );\r
xExpectedNumber = xBlockPeriod / xTimerPeriod;\r
\r
- ucMaxAllowableValue = ( ( unsigned char ) xExpectedNumber ) ;\r
- ucMinAllowableValue = ( unsigned char ) ( ( unsigned char ) xExpectedNumber - ( unsigned char ) 1 ); /* Weird casting to try and please all compilers. */\r
+ ucMaxAllowableValue = ( ( uint8_t ) xExpectedNumber ) ;\r
+ ucMinAllowableValue = ( uint8_t ) ( ( uint8_t ) xExpectedNumber - ( uint8_t ) 1 ); /* Weird casting to try and please all compilers. */\r
\r
if( ( ucAutoReloadTimerCounters[ ucTimer ] < ucMinAllowableValue ) ||\r
( ucAutoReloadTimerCounters[ ucTimer ] > ucMaxAllowableValue )\r
\r
static void prvTest4_CheckAutoReloadTimersCanBeStopped( void )\r
{ \r
-unsigned char ucTimer;\r
+uint8_t ucTimer;\r
\r
/* Check the auto reload timers can be stopped correctly, and correctly\r
report their state. */\r
\r
/* Stop all the active timers. */\r
- for( ucTimer = 0; ucTimer < ( unsigned char ) configTIMER_QUEUE_LENGTH; ucTimer++ )\r
+ for( ucTimer = 0; ucTimer < ( uint8_t ) configTIMER_QUEUE_LENGTH; ucTimer++ )\r
{\r
/* The timer has not been stopped yet! */\r
if( xTimerIsTimerActive( xAutoReloadTimers[ ucTimer ] ) == pdFALSE )\r
be active. The critical section is used to ensure the timer does\r
not call its callback between the next line running and the array\r
being cleared back to zero, as that would mask an error condition. */\r
- if( ucAutoReloadTimerCounters[ configTIMER_QUEUE_LENGTH ] != ( unsigned char ) 0 )\r
+ if( ucAutoReloadTimerCounters[ configTIMER_QUEUE_LENGTH ] != ( uint8_t ) 0 )\r
{\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
/* The timers are now all inactive, so this time, after delaying, none\r
of the callback counters should have incremented. */\r
vTaskDelay( ( ( TickType_t ) configTIMER_QUEUE_LENGTH ) * xBasePeriod );\r
- for( ucTimer = 0; ucTimer < ( unsigned char ) configTIMER_QUEUE_LENGTH; ucTimer++ )\r
+ for( ucTimer = 0; ucTimer < ( uint8_t ) configTIMER_QUEUE_LENGTH; ucTimer++ )\r
{\r
- if( ucAutoReloadTimerCounters[ ucTimer ] != ( unsigned char ) 0 )\r
+ if( ucAutoReloadTimerCounters[ ucTimer ] != ( uint8_t ) 0 )\r
{\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
configASSERT( xTestStatus );\r
}\r
\r
- if( ucOneShotTimerCounter != ( unsigned char ) 0 )\r
+ if( ucOneShotTimerCounter != ( uint8_t ) 0 )\r
{\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
configASSERT( xTestStatus );\r
}\r
\r
- if( ucOneShotTimerCounter != ( unsigned char ) 1 )\r
+ if( ucOneShotTimerCounter != ( uint8_t ) 1 )\r
{\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
else\r
{\r
/* Reset the one shot timer callback count. */\r
- ucOneShotTimerCounter = ( unsigned char ) 0;\r
+ ucOneShotTimerCounter = ( uint8_t ) 0;\r
}\r
\r
if( xTestStatus == pdPASS )\r
\r
static void prvTest6_CheckAutoReloadResetBehaviour( void )\r
{\r
-unsigned char ucTimer;\r
+uint8_t ucTimer;\r
\r
/* Check timer reset behaviour. */\r
\r
configASSERT( xTestStatus );\r
}\r
\r
- if( ucOneShotTimerCounter != ( unsigned char ) 0 )\r
+ if( ucOneShotTimerCounter != ( uint8_t ) 0 )\r
{\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
configASSERT( xTestStatus );\r
}\r
\r
- if( ucAutoReloadTimerCounters[ configTIMER_QUEUE_LENGTH - 1 ] != ( unsigned char ) 0 )\r
+ if( ucAutoReloadTimerCounters[ configTIMER_QUEUE_LENGTH - 1 ] != ( uint8_t ) 0 )\r
{\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
\r
/* The timers were not reset during the above delay period so should now\r
both have called their callback functions. */\r
- if( ucOneShotTimerCounter != ( unsigned char ) 1 )\r
+ if( ucOneShotTimerCounter != ( uint8_t ) 1 )\r
{\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
\r
/* Clear the timer callback counts, ready for another iteration of these\r
tests. */\r
- ucAutoReloadTimerCounters[ configTIMER_QUEUE_LENGTH - 1 ] = ( unsigned char ) 0;\r
- ucOneShotTimerCounter = ( unsigned char ) 0;\r
+ ucAutoReloadTimerCounters[ configTIMER_QUEUE_LENGTH - 1 ] = ( uint8_t ) 0;\r
+ ucOneShotTimerCounter = ( uint8_t ) 0;\r
\r
if( xTestStatus == pdPASS )\r
{\r
\r
static void prvResetStartConditionsForNextIteration( void )\r
{\r
-unsigned char ucTimer;\r
+uint8_t ucTimer;\r
\r
/* Start the timers again to start all the tests over again. */\r
\r
/* Start the timers again. */\r
- for( ucTimer = 0; ucTimer < ( unsigned char ) configTIMER_QUEUE_LENGTH; ucTimer++ )\r
+ for( ucTimer = 0; ucTimer < ( uint8_t ) configTIMER_QUEUE_LENGTH; ucTimer++ )\r
{\r
/* The timer has not been started yet! */\r
if( xTimerIsTimerActive( xAutoReloadTimers[ ucTimer ] ) != pdFALSE )\r
\r
static void prvAutoReloadTimerCallback( TimerHandle_t pxExpiredTimer )\r
{\r
-unsigned long ulTimerID;\r
+uint32_t ulTimerID;\r
\r
- ulTimerID = ( unsigned long ) pvTimerGetTimerID( pxExpiredTimer );\r
+ ulTimerID = ( uint32_t ) pvTimerGetTimerID( pxExpiredTimer );\r
if( ulTimerID <= ( configTIMER_QUEUE_LENGTH + 1 ) )\r
{\r
( ucAutoReloadTimerCounters[ ulTimerID ] )++;\r